Bug #15615: pg_exec update table sets column to NULL instead of updating it
| From: | mercy at edsamail dot com | Date: | Tue, 19 Feb 2002 09:45:44 +0000 |
| Subject: | Bug #15615: pg_exec update table sets column to NULL instead of updating it | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-550@lists.php.net to get a copy of this message | ||
From: mercy@edsamail.com
Operating system: Linux
PHP version: 4.1.1
PHP Bug Type: PostgreSQL related
Bug description: pg_exec update table sets column to NULL instead of updating it
im using PHP-WML and i was trying to update a table in postgres with this:
<?
function edit($id,$nick,$new_nick) {
$sql = "UPDATE address_book SET nick='$new_nick' WHERE id=$id AND
nick='$nick'";
$update = pg_exec($sql);
echo("$sql");
}
?>
OUTPUT ON SCREEN:
UPDATE address_book SET nick='STP' WHERE id=1 AND nick='pearl jam'
PGSQL DATABASE BEFORE:
id | nick | email
----+-----------+------------------------
1 | globedev | mercy@edsamail.com
1 | globedev | jay@edsamail.com
1 | globedev | macky@edsamail.com
1 | globedev | paul@edsamail.com
1 | nirvana | test@edsamail.com
1 | metallica | metallica@edsamail.com
1 | pearl jam | pearl_jam@edsamail.com
PGSQL DATABASE AFTER:
id | nick | email
----+-----------+------------------------
1 | globedev | mercy@edsamail.com
1 | globedev | jay@edsamail.com
1 | globedev | macky@edsamail.com
1 | globedev | paul@edsamail.com
1 | nirvana | test@edsamail.com
1 | metallica | metallica@edsamail.com
1 | | pearl_jam@edsamail.com
--
Edit bug report at http://bugs.php.net/?id=15615&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=15615&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=15615&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=15615&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=15615&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=15615&r=support
Expected behavior: http://bugs.php.net/fix.php?id=15615&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=15615&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=15615&r=submittedtwice