note 31409 added to function.pg-update

From: Date: Mon, 21 Apr 2003 03:44:39 +0000
Subject: note 31409 added to function.pg-update
Groups: php.notes 
Request: Send a blank email to php-notes+get-46866@lists.php.net to get a copy of this message
Well, you play with experimental code and you end up spending a lot of time doing experiments! It appears the documentation is a bit incorrect here (or I'm reading it wrong). The correct order for this function's arguments is: <pre> mixed pg_update ( resource connection, string table_name, array data, array condition [, int options]) NOT mixed pg_update ( resource connection, string table_name, array condition, array data [, int options]) </pre> Notice that the 'data' and 'condition' are backwards. I'm running PHP 4.3.1 and noticed this. Here's some code that's working for me: <pre> // table name $table_name = 'subscription'; // data updates $data = array( 'subs_name' => $subs_name, 'subs_lead_quantity' => $subs_lead_quantity, 'subs_value_code' => $subs_value_code, 'subs_max_usage' => $subs_max_usage); // criteria $match = array('subs_id' => $subs_id); // update code... $res = pg_update($conn, $table_name, $data, $match); </pre> Looking forward to seeing this code and documentation more mature. --dante -- http://www.php.net/manual/en/function.pg-update.php http://master.php.net/manage/user-notes.php?action=edit+31409 http://master.php.net/manage/user-notes.php?action=delete+31409 http://master.php.net/manage/user-notes.php?action=reject+31409

« previous php.notes (#46866) next »