Re: Random select -- Where am I going wrong?
| From: | Larry E . Ullman | Date: | Sun, 04 Jul 2004 14:01:52 +0000 |
| Subject: | Re: Random select -- Where am I going wrong? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-35122@lists.php.net to get a copy of this message | ||
Here is my code.... I keep on getting a Resource id #2 ......whatever that means....any help would be appreciated!
$music = mysql_query ("Select * from $db_table ORDER BY RAND() Limit 1"); if(!$music) die("Query Failed."); while($row = mysql_fetch_row($music)) print "$music"; }This is because you're printing $music--which is the resource ID--when you should be working with $row. Also, you're going to need to actually print $row[0] or $row['column'], not just $row. Larry