i have a mysql db table on godaddy with 5 fields: id, linkURL, graphic, impressions, clicks
using a php script downloaded from http://www.phpjabbers.com/free-banner-and-link-click-counter-script, i am able to record the clicks perfectly but i had to adapt things a bit in order to grab the graphic addresses and record the graphic impressions. (my banner graphics, with different links, are side-by-side.)
what i have works fine, but is a mess, i am certain.
could someone please tell me how to clean up the code:
<?php error_reporting(0); include("config.php");$sql = “SELECT * FROM “.$SETTINGS[“data_table”].” WHERE id=19”;
$sql_result = mysql_query ($sql, $connection ) or die ('request “Could not execute SQL query” '.$sql);
if (mysql_num_rows($sql_result)>0) {
while ($row = mysql_fetch_assoc($sql_result)) {
$sql = “UPDATE “.$SETTINGS[“data_table”].” SET impressions=impressions+1 WHERE id=19”;
$sql_result = mysql_query ($sql, $connection ) or die ('request “Could not execute SQL query” '.$sql);
echo “<img src=”.$row[“graphic”]." />";
}
}
?>
$sql = “SELECT * FROM “.$SETTINGS[“data_table”].” WHERE id=20”;
$sql_result = mysql_query ($sql, $connection ) or die ('request “Could not execute SQL query” '.$sql);
if (mysql_num_rows($sql_result)>0) {
while ($row = mysql_fetch_assoc($sql_result)) {
$sql = “UPDATE “.$SETTINGS[“data_table”].” SET impressions=impressions+1 WHERE id=20”;
$sql_result = mysql_query ($sql, $connection ) or die ('request “Could not execute SQL query” '.$sql);
echo “<img src=”.$row[“graphic”]." />";
}
}
?>
thank you very much!