Re: Supplied argument is not a valid MySQL result resource

From: Date: Thu, 20 Jun 2002 10:21:16 +0000
Subject: Re: Supplied argument is not a valid MySQL result resource
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-103100@lists.php.net to get a copy of this message
I have tried your suggestions and no luck. The value of $fn is home.php echoing the $query looks fine I ran it through a SQL validator and it was fine JJ Harrison webmaster@tececo.com www.tececo.com ----- Original Message ----- From: "Stuart Dallas" <stuart@sharedserver.net> To: <php-general@lists.php.net> Sent: Thursday, June 20, 2002 8:09 PM Subject: Re: [PHP] Supplied argument is not a valid MySQL result resource > On Thursday, June 20, 2002, 9:19:27 AM, webmaster@tececo.com wrote: > > <? > > $link = mysql_pconnect("localhost", "root", "") or > > die("Could not connect"); > > mysql_select_db("tececo") or die("Could not select database"); > > $fn = explode("/", $_SERVER['PHP_SELF']); > > $num_of_s = count($fn) - 1; > > $fn = "$fn[$num_of_s]"; > > $query = "SELECT * FROM meta_data WHERE page_name = $fn"; > > $result = mysql_query($query); > > $num_results = mysql_num_rows($result); > > $row = mysql_fetch_array($result); > > $id = $row['id']; > > $title = $row['title']; > > $description = $row['description']; > > $keywords = $row['keywords']; > ?>> > > > I get this error: > > > Warning: Supplied argument is not a valid MySQL result resource in C:\TecEco(Converting To PHP)\includes\meta.array_create.php on line 9 > > > Warning: Supplied argument is not a valid MySQL result resource in C:\TecEco(Converting To PHP)\includes\meta.array_create.php on line 10 > > > Why? > > This indicates an error in your SQL statement. I would suggest printing $query > to make sure it contains what you think it should. is $fn numeric? If not then > it should be enclosed in quotes in the SQL statement. > -- > Stuart > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#103100) next »