Is there a way to count how many times an image how been clicked. And once the image is clicked have it displayed?
I am currently pulling random images from a database and want to show which is has been clicked the most.
<html> <body>
<div style="float:left"> <?php // Connect to the database mysql_connect ('localhost', 'root') ; mysql_select_db ('links');
// Number of images $num_displayed = 1 ;
// Select random images from the database $result = mysql_query ("SELECT * FROM links ORDER BY RAND() LIMIT $num_displayed");
// For all the rows that are selected while ($row = mysql_fetch_array($result))
// Display images { echo "<a href=\"".$row["link"]."\"><img src=\"".$row["image"]."\" border=0 alt=\"".$row["text"]."\"></a>"; } ?> </div>
<div style="float:left; margin-left:100px"> <?php include("image2.php"); ?>
</div> </body> </html>
thanks.
Create a trigger in image table to count selects
Perform your querys ordering by counter field.
To register clicks, implements a click tracker quering an update on second field, like ‘clicks’