X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id CFB77D1D086 for ; Mon, 19 Apr 2004 11:25:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 42473-01 for ; Mon, 19 Apr 2004 11:25:31 -0300 (ADT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 585F6D1CC8D for ; Mon, 19 Apr 2004 11:25:26 -0300 (ADT) Received: from commandprompt.com (dsl093-038-087.pdx1.dsl.speakeasy.net [66.93.38.87]) (authenticated) by hosting.commandprompt.com (8.11.6/8.11.6) with ESMTP id i3JEPMu25451; Mon, 19 Apr 2004 07:25:22 -0700 Message-ID: <4083E148.1030807@commandprompt.com> Date: Mon, 19 Apr 2004 07:25:12 -0700 From: Robby Russell Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 0.5 (X11/20040208) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Yasmine Kedoo Cc: pgsql-php@postgresql.org Subject: Re: UPDATE - Changing Password References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/27 X-Sequence-Number: 2684 Yasmine Kedoo typed this on 04/18/2004 02:23 AM: > Hi. > > I have changed the code as suggested, but still no luck, and a new > error. The error is: > > Fatal error: Call to undefined function: pg_affected_rows() in > /home/webpages/yamkedoo/Tests/chpw1.php on line 55 > > I used the following code: > > if(!$database) > { > echo "Connection Failed
"; > exit; > } > > else > { > $gdidno = addslashes(trim($formgpid)); > $newpw = addslashes(trim($formnewpw)); > $newpw1 = addslashes(trim($formnewpw1)); > > $query = "UPDATE gpinfo SET password='$newpw' WHERE > gpid='$gpidno'"; > $result = pg_exec($database, $query); > > if(!$result) > { > print "There was a problem accessing the database"; > exit; > } > else if(pg_affected_rows($result)!=1) > { > print "Update Failed\n"; > exit; > } > else if($result) > { > > print "Update Successful\n
"; > > } > } > > > I tried removing this section of the code: else > if(pg_affected_rows($result)!=1) > { > print "Update Failed\n"; > exit; > } > > as this is where the error is, then got "Update Successful", but the > password had not been updated. > > Any ideas? > > Yasmine > After you set the variable $query, print it out. > > $query = "UPDATE gpinfo SET password='$newpw' WHERE gpid='$gpidno'"; print "My Query: " . $query; > $result = pg_exec($database, $query); What does it print out? Then try copying that and running it directly in postgresql. If your query is failing, you can debug it that way. -Robby -- Robby Russell, | Sr. Administrator / Lead Programmer Command Prompt, Inc. | http://www.commandprompt.com rrussell@commandprompt.com | Telephone: (503) 667.4564