RE: [PHP] Unable to get a form to update CODE AS REQUESTED

From: Date: Fri, 23 Aug 2002 14:59:44 +0000
Subject: RE: [PHP] Unable to get a form to update CODE AS REQUESTED
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-113779@lists.php.net to get a copy of this message
[snip] if ($person_id) { require ("config.inc.php"); $db = mysql_pconnect($hostname,$user,$password); mysql_select_db("contacts",$db); $sql = "UPDATE people SET first_name='$first_name', last_name='$last_name', organisation='$organisation', title='$title', home_phone='$home_phone', work_phone='$work_phone', mobile_phone='$mobile_phone', email1='$email1', dob='$dob', grouping='$grouping', home_address='$home_address', work_address='$work_address', notes='$notes' WHERE person_id=$person_id"; } OK, have you done print($sql) to make sure the query looks ok? That is the first thing I would do. Also, I do this syntax that works cleanly for me, but you may not like it; $sql = "UPDATE people SET first_name='" . $first_name . "', last_name='" . $last_name . "', organisation='" . $organisation . "', title='" . $title . "', But print the statement out and check it for problems. IIRC you said that the INSERT worked fine. Wait! I see the problem, the last line in the update; WHERE person_id=$person_id"; should be WHERE person_id='$person_id'"; Dang syntax error ... ALWAYS, ALWAYS, ALWAYS print out your completed SQL statements during testing, it will save you much time. HTH! Jay "It's hip to snip!" *********************************************************** * Texas PHP Developers Conf Spring 2003 * * T Bar M Resort & Conference Center * * New Braunfels, Texas * * San Antonio Area PHP Developers Group * * Contact jay.blanchard@niicommunications.com * * * * Want to present a paper or workshop? Contact now! * ***********************************************************

« previous php.general (#113779) next »