Re: mysql error

From: Date: Wed, 14 Aug 2002 04:35:12 +0000
Subject: Re: mysql error
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-112482@lists.php.net to get a copy of this message
it's the WHERE clause, it's illegal there. what are you trying to do? if you want to change the heading & paragraph columns of every row in malibu_data where the page_name & par_id match your values, this should be an UPDATE. if you want to create a new record in malibu_data for every record that meets your criteria - which would be a kind of strange thing to do, but whatever - you'd need to write it like insert into malibu_data (heading,paragraph) select '$heading', '$paragraph' from malibu_data where page_name = '$page_name' and par_id = '$par_id' Always try to run your queries in MySQL directly first. You'd see the same error, and remove worries about any kind of PHP coding problem. On Wed, 14 Aug 2002 victor@argilent.com wrote: > I get this error: > > Error submiting paragraph.You have an error in your SQL syntax near > 'WHERE page_name='features' AND par_id='13' ' at line 1 > > > But my code, I think is fine: > > // Insert the form information into the database > mysql_query("INSERT INTO malibu_data SET heading='$heading', > paragraph='$paragraph' > WHERE page_name='$page_name' AND par_id='$par_id' ") > or die ('Error submiting paragraph.'. mysql_error()); > > > - Vic > > > > ______________________________________________________________________ > Post your ad for free now! http://personals.yahoo.ca > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#112482) next »