Help with visitor counter


#1

Hi

On my previous hosted site I successfully used freecounterstat but cannot get this to work on my site here on 000webhost, can anybody offer any help please? Is it a permission problem or is that type of counter barred?


#2

Try
http://www.hitwebcounter.com


#3

You can use mysql_fetch_assoc or mysql_fetch_array function.

$Connect = mysql_connect(‘Localhost’,‘root’,’’);
$Database = mysql_select_db(“myDatabaseName”);
$Result = mysql_query(“SELECT visit FROM myWebsite”);

$CurrentVisit = mysql_fetch_assoc($Result[“visit”]);

$NewVisit = $CurrentVisit+1;
$UpdateField = mysql_query(“UPDATE myWebsite SET visit = ‘$NewVisit’”);
echo $NewVisit;

If you don’t need old counter value in your code (for some other manipulations) and you just need to increment database value, you can run just UPDATE myWebsite SET visit = visit+1 query.


#4

Thank you both for such a quick response and as I am a newbie in web design and general programming so sorry navjot789 I don’t understand what I needed. I went for the easy option that suggested by ckhawand and which works perfectly. Also I need to start at a specific number to follow on from the previous site. Thanks again, Andrew.


#5