Hi Chris,
If you're using MySQL 3.23+, you might want to consider using something
like:
SELECT songname FROM mp3 ORDER BY RAND() LIMIT 1
Not that this answers your original problem, but it seems to make more sense
than manually coding a random number (which is, perhaps, impractical
especiallyif you plan to add / take away entries to your table on a regular
basis).
James
"Chris Cocuzzo" <[EMAIL PROTECTED]> wrote in message
014d01c113ca$dd3bf460$[EMAIL PROTECTED]">news:014d01c113ca$dd3bf460$[EMAIL PROTECTED]...
> <?php
> $id = rand(1,2);
> $query = "SELECT songname FROM mp3 WHERE sgid = " .$id;
> $result = mysql_query($query,$connection);
> $mp3d = mysql_fetch_array($result);
> ?>
>
> the server is telling me line 43(which starts with $mp3d) is not a valid
> mysql result resource. what am i doing wrong??
>
> chris
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]