note 60929 added to function.pg-prepare
| From: | mdv at inyourpocket dot com | Date: | Fri, 20 Jan 2006 13:10:17 +0000 |
| Subject: | note 60929 added to function.pg-prepare | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102159@lists.php.net to get a copy of this message | ||
you can't use IN in WHERE:
<?php
$result = pg_prepare($dbconn, "my_query", 'SELECT * FROM shops WHERE name
IN($1)');
$result = pg_execute($dbconn, "my_query", array("'cofee', 'beer',
'hard'"));
?>
query is rewriten as:
SELECT * FROM shops WHERE name IN ('\'cofee\', \'beer\',
\'hard\'');
but you want:
SELECT * FROM shops WHERE name IN ('cofee', 'beer', 'hard');
----
Server IP: 212.24.129.6
Probable Submitter: 62.245.81.254
----
Manual Page -- http://www.php.net/manual/en/function.pg-prepare.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60929
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60929&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60929&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60929&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60929&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60929&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60929&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60929&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60929&report=yes
Search -- http://master.php.net/manage/user-notes.php