title: image click counter
body: <p>Is there a way to count how many times an image how been clicked. And once the image is clicked have it displayed?</p>
  
  <p>I am currently pulling random images from a database and want to show which is has been clicked the most.</p>
  
  <pre><code>&lt;html&gt;   &lt;body&gt;
  
  &lt;div style="float:left"&gt; &lt;?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 "&lt;a href=\"".$row["link"]."\"&gt;&lt;img src=\"".$row["image"]."\" border=0 alt=\"".$row["text"]."\"&gt;&lt;/a&gt;"; } ?&gt; &lt;/div&gt;
  
  &lt;div style="float:left; margin-left:100px"&gt; &lt;?php include("image2.php"); ?&gt;
  
  &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;
  </code></pre>
  
  <p>thanks.</p>