On Thu, Sep 11, 2008 at 12:08 PM, Jason Pruim <japruim@xxxxxxxxxx> wrote: > > On Sep 11, 2008, at 11:23 AM, Stut wrote: > >> On 11 Sep 2008, at 16:15, Jason Pruim wrote: >>> >>> Attempting to setup a prepared statement in php that will update a record >>> in a mysql database using mysqli >>> >>> Here is the relevant code: >>> $stmt = mysqli_stmt_init($link); >>> mysqli_stmt_prepare($stmt, "UPDATE purl.schreur (FName, LName, >>> email, phone, record, subscribed, date, IPAddress, Business, Address1, City, >>> State, Zip, Coffee, Meeting, areaPlans) VALUES >>> (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); >>> [snip] >>> >>> Here is my error message: >>> >>> You have an error in your SQL syntax; check the manual that corresponds >>> to your MySQL server version for the right syntax to use near '(FName, >>> LName, email, phone, record, subscribed, date, IPAddress, Business, Addr' at >>> line 1 >>> >>> Now I may just be being dense but I can't figure out the problem... >>> Migraines are not helping right now though.... >>> >>> Can anyone see my stupid mistake? :) >> >> That's the syntax for an insert statement. Suggest you read this: >> http://dev.mysql.com/doc/refman/5.0/en/update.html > > Hmmm... I looked at it, but didn't see anything that would help with a > prepared statement :) > > Am I that dense or can't we do updates with prepared statements? > You're just having a bad day and missing it. The problem isn't that you're using a prepared statement or not. The problem is that you're confusing the SQL syntax inside your statement: INSERT INTO purl.schreur (FName, LName, email, phone, record, subscribed, date, IPAddress, Business, Address1, City, State, Zip, Coffee, Meeting, areaPlans) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) or UPDATE purl.schreur SET FName = ?, LName = ?, email = ?, phone = ?, record = ?, subscribed = ?, date = ?, IPAddress = ?, Business = ?, Address1 = ?, City = ?, State = ?, Zip = ?, Coffee = ?, Meeting = ?, areaPlans = ? WHERE [some condition that identifies the row or rows that you want to update] Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php