Re: Supplied argument is not a valid MySQL result resource

From: Date: Tue, 10 Apr 2001 07:00:18 +0000
Subject: Re: Supplied argument is not a valid MySQL result resource
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-47973@lists.php.net to get a copy of this message
That means that your mysql_query probably returned an error. It should do that only when you screw up your syntax. echo/print out the syntax used in your query, and post it here. That is probably the problem you are having. -- Plutarck Should be working on something... ...but forgot what it was. ""Nathan Roberts"" <Nathan@fpandts.com> wrote in message news:9atdps$kgv$1@toye.p.sourceforge.net... > I am trying to get to grips with managing data in mysql, am am currentky > working on deleting records > > I have worked through a turorial - no problems, but now I am trying to apply > it to my own database, I am getting the error > Warning: Supplied argument is not a valid MySQL result resource in .... on > line 14 > > I cannot see what is causing it - if anyone can it would be much > appreciated. > > thanks > > Nathan > > For clarity/brevity I have cut the page back to what i beleive to be the > relivant part. Code for page is:- > > <html> > > <body> > > <?php > > $db = mysql_connect("localhost", "username", "pasword"); > > mysql_select_db("catalogue",$db); > > > $result = mysql_query("SELECT * FROM SECTIONS",$db); > > while ($myrow = mysql_fetch_array($result)) { > > printf("<a href=\"%s?section_id=%s\">%s %s</a> \n", > $PHP_SELF, > $myrow["section_id"], $myrow["section_name"], $myrow["section"]); > > printf("<a > href=\"%s?id=%s&delete=yes\">(DELETE)</a><br>", $PHP_SELF, > $myrow["section_id"]); > > } > > > ?> > > > > </body> > > </html> > > > SQL for the table is > > CREATE TABLE SECTIONS ( > section_name varchar(25) NOT NULL, > section_id tinyint(3) unsigned DEFAULT '0' NOT NULL auto_increment, > section char(1) NOT NULL, > PRIMARY KEY (section_id), > UNIQUE section (section_name, section_id, section) > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#47973) next »