SV: [PHP-DB] newbie having problem
| From: | Torgil Zechel | Date: | Mon, 03 Sep 2001 10:38:18 +0000 |
| Subject: | SV: [PHP-DB] newbie having problem | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-12111@lists.php.net to get a copy of this message | ||
Check if mysql_query returns false. If it does (and im pretty sure it do),
use mysql_error to check whats wrong... (Another way is to echo the query
and paste it into the mysql command line client..)
$result = mysql_query("...");
if( $result == FALSE )
{
echo mysql_error();
}
> I'm doing some basic php/MySQL stuff (LinuxPPC on Mac7100). I'm
> gettin g the
> following error when I search for somthing.
> ========
> Supplied argument is not a valid MySQL result resource in
> /usr/local/apache/htdocs/bizflyer/Bizflyer_R1.php on line 32
> ========
> Here's my relevant code:
> ========
> <?php
> mysql_connect ('pingu','root@localhost','');
> mysql_select_db ('Bizplanes');
> if ($Serial == "")
> {$Serial = '%';}
> if ($Type == "")
> {$Type = '%';}
> if ($Con == "")
> {$Con = '%';}
> $result=mysql_query ("SELECT * FROM biz WHERE
> ID LIKE '%$Serial%' AND
> Type LIKE '%$Type%'
> Con LIKE '%$Con%'
> ORDER BY ID");
> ?>
>
> TABLE STUFF HERE
>
> <?php
> if ($row=mysql_fetch_array($result)) { ######### this is line 32
> do {
> print ("<TR><TD>");
> print $row['ID'];
> print ("<TD>");
> print $row['Type'];
> print ("<TD>");
> print $row['Con'];
> print ("<TD>");
> print $row['Operator'];
> print ("</TD></TR>");
> } while ($row=mysql_fetch_array($result));
> } else {print ("Sorry, no aircraft matching your criteria were found.");}
> ?>
> =========
>
> Any suggestions as to where I'm going wrong?
>
>
> Regards
>
> George Pitcher
>
> Technical Manager
> HERON Project
> Napier University
> Edinburgh EH10 5DT
>
> fmdev@yahoo.co.uk
> gep1@stir.ac.uk
> safc2_1nufc@yahoo.com
>
> http://www.heron.ac.uk
> ================================================
> programmer - A device for transmuting caffeine into code.
> ================================================
>
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>