I am trying to code some advertising banners on my page based on random picks from a table in my DB. I have successfully got my top banner to display and log an impression:
// Top Banner
$query="SELECT * FROM sm_ADS WHERE id_Maze_Category='$Category_ID' and Type='large' and Active='1' ORDER BY RAND() LIMIT 1";
$result=mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$AD_ID=$row["id"];
$User=$_SESSION['SESS_MEMEBER_ID'];
$Type="Image_Imp";
$sql="INSERT INTO sm_History (AD_ID, User_ID, Type) VALUES ('$AD_ID','$User','$Type')";
$result = mysql_query($sql) or die(mysql_error());
$TopBanner = "<A HREF=\"image_click.php?url={$row["URL"]}&id={$AD_ID}\" TARGET=\"_blank\""." BORDER=\"0\"><img src=\"/ADS/{$row["file_name"]}\" alt=\"\"/></A>";
I just enter the $TopBanner where it needs to go in my page.
Using the same logic above, I need to choose 3 smaller banners to display of the side of my page with goal that I produce 3 variables called:
$smallBanner1
$smallBanner2
$smallBanner3
the query needs to be this:
$query="SELECT * FROM sm_ADS WHERE id_Maze_Category='$Category_ID' and Type='small' and Active='1' ORDER BY RAND() LIMIT 3";
I, also, need to LOG each impression of the 3 small banners similar to the top banner.
I think I can grunt my way through this, but would sure appreciate some assistance to find a quick way to do this. Thanks!