php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15615 pg_exec update table sets column to NULL instead of updating it
Submitted: 2002-02-19 04:45 UTC Modified: 2002-02-19 04:48 UTC
From: mercy at edsamail dot com Assigned:
Status: Not a bug Package: PostgreSQL related
PHP Version: 4.1.1 OS: Linux
Private report: No CVE-ID: None
 [2002-02-19 04:45 UTC] mercy at edsamail dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-19 04:48 UTC] derick@php.net
The bug system is not the appropriate forum for asking support
questions. For a list of a range of more appropriate places to ask
for help using PHP, please visit http://www.php.net/support.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC