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

Add a Patch

Pull Requests

Add a Pull Request

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-2019 The PHP Group
All rights reserved.
Last updated: Fri May 24 15:01:26 2019 UTC