Re: Why the following error, yet it works anyway

From: Date: Wed, 16 Jan 2002 00:26:59 +0000
Subject: Re: Why the following error, yet it works anyway
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-15862@lists.php.net to get a copy of this message
Chip, You're not going to like this .. on the delete you aren't fetching any rows. Miles At 09:18 AM 1/14/2002 -0800, chip.wiegand@simrad.com wrote:
I have the following short web page to delete dealer bulletins from a database. My page lists all the bulletins in the database - id and subject. There is a text input field to enter the bulletin id number and hit the delete button, and the bulletin is deleted. It works except after the submit delete I get an error - --------------------------------- Warning: Supplied argument is not a valid MySQL result resource in /usr/local/apache/htdocs/bulletin_delete.php on line 35 ----------------------------------------- line 35 is the while statement. Here is the complete page - ----------------------------------------- Simrad Dealer Bulletins - Delete Screen NOTE: This is a permanent and irreversible delete! No second chances here! Enter the bulleting ID Number: <? $db = mysql_connect("localhost", "root") or die ("Can't get the database server"); mysql_select_db("bulletins", $db) or die ("Can't get the database"); if (isset($submit)): $sql = "delete from dbulletins where news_id = '$newsid'"; else: $sql = "select news_id, bulletin_subject from dbulletins"; endif; $result = mysql_query($sql); while ($row = mysql_fetch_array($result)) { print " \nDelete entry ".$row["news_id"]."? " .$row["bulletin_subject"]."\n \n"; } ?> <bulletin_admin.htm>Back ---------------------------------------- -- Chip Wiegand Computer Services Simrad, Inc www.simrad.com chip.wiegand@simrad.com "There is no reason anyone would want a computer in their home."
     --Ken Olson, president, chairman and founder of Digital Equipment
Corporation, 1977 (They why do I have 7? Somebody help me!)


« previous php.db (#15862) next »