Jump to content

Random DISTINCT


phpretard

Recommended Posts

I only want to display only one disint image on a page at s time this... if you refresh sometimes shows 2

 

$result = mysql_query("SELECT DISTINCT image FROM ads ORDER by Rand() LIMIT 1");

while($row = mysql_fetch_array($result))
  {
  $ADimage=$row['image'];
  
  
  $echo= "<div align='center'><img src='ads/$ADimage'></div>";
  
  
  }

 

Any help tonight?

Link to comment
Share on other sites

I think I screwed up my question.  I need 5 images to show up from the DB. If the same image is going to be displayed more than once (one the same page) than I would like to have a default  image its place.

 

Do you know what this means?

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /backup/hsphere/local/home/mercodesigns/mercodesigns.com/classifieds/pages/ads.php on line 6

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.