From: Robby Russell <rrussell@commandprompt.com>
To: Yasmine Kedoo <yazkedoo@hotmail.com>
Cc: pgsql-php@postgresql.org
Subject: Re: UPDATE - Changing Password
Date: Mon, 19 Apr 2004 07:25:12 -0700
Message-ID: <4083E148.1030807@commandprompt.com> (raw)
In-Reply-To: <BAY14-F31cyJw78vrKa0005a58a@hotmail.com>
References: <BAY14-F31cyJw78vrKa0005a58a@hotmail.com>
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<BR>";
> 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<BR>";
>
> }
> }
>
>
> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: rrussell@commandprompt.com, yazkedoo@hotmail.com
Subject: Re: UPDATE - Changing Password
In-Reply-To: <4083E148.1030807@commandprompt.com>
References: <BAY14-F31cyJw78vrKa0005a58a@hotmail.com> <4083E148.1030807@commandprompt.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox