Random select -- Where am I going wrong?
| From: | Ronald \"The Newbie\" Allen | Date: | Sun, 04 Jul 2004 10:54:14 +0000 |
| Subject: | Random select -- Where am I going wrong? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-35121@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!
<html>
<head>
<title>Top Frame</title>
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff"
vlink="#800080"
alink="#ff0000">
<EMBED SRC="" autostart="true" hidden="true" loop="true"
volume="100%">
<?
$db_host = '######;
$db_user = '######';
$db_pass = '######';
$db_name = '######';
$conn = mysql_connect($db_host,$db_user,$db_pass);
if ($conn == true) {
// Select the database.
mysql_select_db($db_name,$conn);
$db_table = 'music';
$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";
}
?>
</body>
</html>