Re: UPDATE - Changing Password

From: Robby Russell <rrussell(at)commandprompt(dot)com>
To: Yasmine Kedoo <yazkedoo(at)hotmail(dot)com>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: UPDATE - Changing Password
Date: 2004-04-19 14:25:12
Message-ID: 4083E148.1030807@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

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(at)commandprompt(dot)com | Telephone: (503) 667.4564

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Adam Witney 2004-04-19 14:53:11 Uploading and parsing a file into a table
Previous Message Keary Suska 2004-04-18 17:35:08 Re: UPDATE - Changing Password