javascript - PHP/MySQL OnClick Update MySQL -


need update hitcount field in mysql table when user clicks on banner ad. have random ad display script working can't figure out how update table when click..assuming have pass id ajax no idea how approach it? code below:

include 'connection.php'; $query = "select * ads adtype = 'small' , status = 'yes' order rand() limit 3"; $result = mysql_query($query) or die(mysql_error());  $num_results = mysql_num_rows($result); if ($num_results !="0") { for($i=0;$i<$num_results;$i++) {     $row = mysql_fetch_array($result);      $client = htmlspecialchars(stripslashes($row['client']));     $link = htmlspecialchars(stripslashes($row['link']));     $filename = htmlspecialchars(stripslashes($row['filename']));     $id = $row['id'];     echo "<tr>";     echo "<td>";     echo '<a href="';     echo $link;     echo '"><img src="thimg/';     echo $filename;     echo '" alt="';     echo $client;     echo '"></a>';     echo "</td>";     echo "</tr>";  } }                  

make link point page takes id of ad parameter, click.php?id=the_id. page can update database, link, , can use header redirect forward them on link. make sure don't output on forwarding page though, or redirect won't work.

this should need, without need javascript or ajax.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -