Freelance Project

All freelance projects at One Location


eng_468x60_peopleflag  eng_468x60_step

Mysql Php Question Solution 03.12.08


Hello,

I’m needing to display a row of 6 banners all pulled from the database randomly but yet not have any duplicate images displaying at the same time.

here is the code I have now. This code displays one banner at a time. I need you to make it display 6 at a time.

[code]

<?php

$banquery = "SELECT * FROM buttons where status=1 and max>shown ORDER BY RAND() LIMIT 1";
$banresult = mysql_query ($banquery);

$banline = mysql_fetch_array($banresult);
$banbannerurl = $banline["bannerurl"];
$banid = $banline["id"];

//update the banners displayed
$updbanquery = "update buttons set shown=shown+1 where id=".$banid;
$updbanresult = mysql_query ($updbanquery);

if ($banbannerurl != "" ) {

?>

<center><table><tr><td><a xxxxxref="<? echo "buttonclick.php?id=".$banid; ?>" target="_blank"><img src="<? echo $banbannerurl; ?>" border="0"></a></td></tr></table></center>

<?

}
?>

[/code]

  • Digg
  • Sphinn
  • FriendFeed
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • StumbleUpon
  • Yahoo! Buzz


If you enjoyed this post, make sure you
Subscribe to my RSS feed!


  • Freelance Arena
  • Unique Premium WordPress Themes
  • teliad - the marketplace for text links