my guess would be that sgid is a character field. if this isn't the case
then try hardcoding a known id into the query and seeing what happens. It
could also be that the connection has failed, try something like:

if ($connection = mysql_connect())
{
...
        $id = rand(1,2);
        $query = "SELECT songname FROM mp3 WHERE sgid = " .$id;
        if ($result = mysql_query($query,$connection))
        {       $mp3d = mysql_fetch_array($result);
                ...
        } else echo("query failed");
...
} else echo("connection failed");

this'll give you an idea of where it's going wrong

        Tim Ward
        Senior Systems Engineer

Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html


> -----Original Message-----
> From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]]
> Sent: 23 July 2001 23:57
> To: [EMAIL PROTECTED]
> Subject: [PHP]MySQL error, what's wrong here..
> 
> 
> <?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]

Reply via email to