Private Label and Cobranded VoIP Solutions
BrainCast internet & phone based message/memo recording & reminder organization system
Internet Phone Service and Broadband Phone Service by ViaTalk

Go Back   VoIP Forums, Internet Phone Service Forums, & Web Hosting Forums > CoderForums - Programming Discussion > General Programming Issues > Programming Languages & Technologies > PHP

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-19-2002, 02:37 PM
gic0m gic0m is offline
Registered User
 
Join Date: Dec 2000
Posts: 32
Exclamation Random item problem

How come this:

$query = "SELECT * FROM nesroms order by RAND() LIMIT 1";
$result = mysql_query($query);
$row = mysql_fetch_array($result);


Shows up an ERROR when I use it? 2 days ago it didnt, now all the sudden, it says:

Warning: Supplied argument is not a valid MySQL result resource in 1atop.php on line 279


Is there another way to select a random row from a DB?
Thanx in advance
Reply With Quote
  #2  
Old 01-29-2002, 01:58 AM
dionyzos dionyzos is offline
Registered User
 
Join Date: Jan 2002
Posts: 13
Send a message via ICQ to dionyzos
Make sure "nesroms" contains records and that it's spelled correctly. Sometimes, adding « or die(mysql_error()); » after the query-line helps a lot.

I fetch RANDOM ROWS on an hourly basis and it works fine.

Hope this helps.

- dionyzos.
__________________
Mickaėl Nadeau. President
Pure Media Productions
-----
mickael.nadeau@puremedia.ca
http://www.puremedia.ca
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump