Re: UPDATE - Changing Password

Поиск
Список
Период
Сортировка
От Robby Russell
Тема Re: UPDATE - Changing Password
Дата
Msg-id 4083E148.1030807@commandprompt.com
обсуждение исходный текст
Ответ на Re: UPDATE - Changing Password  ("Yasmine Kedoo" <yazkedoo@hotmail.com>)
Список 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@commandprompt.com | Telephone: (503) 667.4564

В списке pgsql-php по дате отправления:

Предыдущее
От: Keary Suska
Дата:
Сообщение: Re: UPDATE - Changing Password
Следующее
От: Adam Witney
Дата:
Сообщение: Uploading and parsing a file into a table