Little Help Please
Posted: Tue Aug 17, 2010 3:42 pm
Am trying to make a click counter in php and mysql, but all i can do, i make hit counter it only counts every hit on the web where links are shown. Here's what i've done so far:
if you choose to help me here are the fields in the database:
Name,Link,id,hits,number
, so if anyone could help me would be the best thing, Thanks.
if you choose to help me here are the fields in the database:
Name,Link,id,hits,number
I try to make it like this but it wont count at all:mysql_select_db("DATABASE", $con);
$result = mysql_query("SELECT * FROM links ORDER BY hits DESC LIMIT 15");
while($row = mysql_fetch_array($result))
{
echo "<a href=$row[Link]>$row[Name]</a>";
echo "<br/>";
}
mysql_query("UPDATE links SET hits=hits+1");
Before i reached here everything went well, but here i totally blockedwhile($hits= mysql_fetch_array($result))
{
$link=$hits[Link];
mysql_query("UPDATE links SET hits=hits+1 WHERE Link =$link");
}