note 78102 added to function.pg-insert

From: Date: Thu, 27 Sep 2007 19:49:18 +0000
Subject: note 78102 added to function.pg-insert
Groups: php.notes 
Request: Send a blank email to php-notes+get-130859@lists.php.net to get a copy of this message
If you need schema support, this function will do something similar to pg_insert: function pg_insert_with_schema($connection, $table, $updates) { $schema = 'public'; if (strpos($table, '.') !== false) list($schema, $table) = explode('.', $table); if (count($updates) == 0) { $sql = "INSERT INTO $schema.\"$table\" DEFAULT VALUES"; return pg_query($sql); } else { $sql = "INSERT INTO $schema.\"$table\" "; $sql .= '("'; $sql .= join('", "', array_keys($updates)); $sql .= '")'; $sql .= ' values ('; for($i = 0; $i < count($updates); $i++) $sql .= ($i != 0? ', ':'').'$'.($i+1); $sql .= ')'; return pg_query_params($connection, $sql, array_values($updates)); } } ---- Server IP: 209.41.74.194 Probable Submitter: 216.145.226.130 ---- Manual Page -- http://www.php.net/manual/en/function.pg-insert.php Edit -- https://master.php.net/note/edit/78102 Del: integrated -- https://master.php.net/note/delete/78102/integrated Del: useless -- https://master.php.net/note/delete/78102/useless Del: bad code -- https://master.php.net/note/delete/78102/bad+code Del: spam -- https://master.php.net/note/delete/78102/spam Del: non-english -- https://master.php.net/note/delete/78102/non-english Del: in docs -- https://master.php.net/note/delete/78102/in+docs Del: other reasons-- https://master.php.net/note/delete/78102 Reject -- https://master.php.net/note/reject/78102 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#130859) next »