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 6B725D1D1B2 for ; Tue, 20 Apr 2004 05:37:58 -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 27026-02 for ; Tue, 20 Apr 2004 05:37:59 -0300 (ADT) Received: from mailhub1.sghms.ac.uk (firewall.sghms.ac.uk [194.82.50.2]) by svr1.postgresql.org (Postfix) with ESMTP id 126FAD1D06C for ; Tue, 20 Apr 2004 05:37:56 -0300 (ADT) Received: from [194.82.51.24] (helo=imail) by mailhub1.sghms.ac.uk with esmtp (Exim 4.24) id 1BFqlL-0003yr-JN; Tue, 20 Apr 2004 09:37:51 +0100 Received: from [172.16.20.3] (mrc1-003.sghms.ac.uk [172.16.20.3]) by imail.sghms.ac.uk (iPlanet Messaging Server 5.2 Patch 1 (built Aug 19 2002)) with ESMTPA id <0HWG00MJCNZ3FI@imail.sghms.ac.uk>; Tue, 20 Apr 2004 09:37:51 +0100 (BST) Date: Tue, 20 Apr 2004 09:37:05 +0100 From: Adam Witney Subject: Re: UPDATE - Changing Password In-reply-to: To: Yasmine Kedoo , pgsql-php Message-id: MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT User-Agent: Microsoft-Entourage/10.1.1.2418 X-MailScanner-Information: Please contact sysadmin at sghms.ac.uk for more information X-MailScanner-MH1: No virueses detected X-MailScanner-SpamCheck: not spam, SpamAssassin (score=-2.7, required 5, APARENTLY_FROM_MYSELF 1.00, BAYES_00 -4.90, FROM_SGHMS -1.00, HTML_MESSAGE 0.10, MY_NO_QU 0.50, MY_OBFUY 1.00, MY_OBFUZ 0.50, POSTMASTER 0.10) X-MailScanner-From: awitney@sghms.ac.uk X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200404/31 X-Sequence-Number: 2688 Hi Yasmine, One way to find out all about your PHP installation is to save this as a script (php_info.php): PHP server info Then put it somewhere accessible from your web server and load it up in your browser Cheers dam > Hey. > > I'd like to thank everyone who helped me. I was able to fix the code by > printing the query to c wat was wrong, and also, pg_cmdtuples( ) was very > useful :-). > > Does anybody know how to find out what version of PHP i may be running? > > Thanx Again > > Yasmine > > > >> From: "Peter Bayley" >> To: "Yasmine Kedoo" >> Subject: Re: [PHP] UPDATE - Changing Password >> Date: Tue, 20 Apr 2004 13:27:01 +1000 >> >> Hi Yasmine >> >> As someone else has already noted, you must be running an early version of >> PHP which doesn't have the pg_affected_rows function. >> >> The older equivalent function is pg_cmdtuples() so you should change your >> code to use the older function >> >> ie: >> >> $result=pg_exec($database, "update gpinfo set password='$newpw' where >> gpid='$gpidno'"); >> if (!$result) { >> print "There was a problem accessing the database >> [".pg_errormessage($database)."]\n"; >> exit; >> } >> if(pg_cmdtuples($result) !=1 ) { >> print "Update Failed: (".pg_cmdtuples($result)." rows were affected)\n"; >> exit; >> } >> print "Update Successful\n
"; >> >> Regards >> >> Peter >> >> ----- Original Message ----- >> From: "Yasmine Kedoo" >> To: >> Sent: Sunday, April 18, 2004 7:23 PM >> Subject: Re: [PHP] UPDATE - Changing Password >> >> >>> 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 >>> >>> >>> >>> >>> >>> >>> >>>> From: "Peter Bayley" >>>> To: "Yasmine Kedoo" >>>> Subject: Re: [PHP] UPDATE - Changing Password >>>> Date: Sun, 18 Apr 2004 17:28:18 +1000 >>>> >>>> Hi Yasmine, >>>> >>>> An update will not return rows from the query so pg_num_rows will be 0. >>>> You >>>> should use pg_affected_rows as in.. >>>> >>>> if (pg_affected_rows($result) != 1) { >>>> ... >>>> >>>> Regards >>>> >>>> Peter >>>> >>>> ----- Original Message ----- >>>> From: "Yasmine Kedoo" >>>> To: >>>> Sent: Sunday, April 18, 2004 8:18 AM >>>> Subject: Re: [PHP] UPDATE - Changing Password >>>> >>>> >>>>> Hi. >>>>> >>>>> I think i've sorted the previous problem now, it was a stupid error >> on >>>> my >>>>> part. But the update is still not working. >>>>> >>>>> I'm using the following script: >>>>> >>>>> 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_numrows($result)!=1) >>>>> { >>>>> print "Update Failed\n"; >>>>> exit; >>>>> } >>>>> else >>>>> { >>>>> >>>>> print "Update Successful\n
"; >>>>> >>>>> } >>>>> } >>>>> >>>>> It is just printing Update Failed now. Can u see where i'm going >> wrong? >>>>> >>>>> Visit the following link: >> www.cyber.brad.ac.uk/~yamkedoo/Tests/chpw.html >>>>> >>>>> Username: jjsanderson >>>>> Password: sanderso >>>>> >>>>> Then on the next page, GP ID: GP000001 >>>>> New Password: hello >>>>> >>>>> and ignore retype password for now. As u can see, it is printing >> update >>>>> failed. Can u see the prob? >>>>> >>>>> Cheers >>>>> >>>>>> From: Robby Russell >>>>>> To: Yasmine Kedoo , pgsql-php@postgresql.org >>>>>> Subject: Re: [PHP] UPDATE - Changing Password >>>>>> Date: Sat, 17 Apr 2004 14:57:43 -0700 >>>>>> >>>>>> Yasmine Kedoo typed this on 04/17/2004 02:48 PM: >>>>>>> Hi Robby. >>>>>>> >>>>>>> That was recommended to me by someone else :) >>>>>>> >>>>>>> When i remove the trim, i still get the same problem. >>>>>>> >>>>>>> Any other ideas? >>>>>>> >>>>>> >>>>>> Are you getting the same exact error at the same exact character in >>>> your >>>>>> query? Send me your error and I'll help you more. >>>>>> >>>>>> Robby >>>>>> >>>>>> -- >>>>>> Robby Russell, | Sr. Administrator / Lead Programmer >>>>>> Command Prompt, Inc. | http://www.commandprompt.com >>>>>> rrussell@commandprompt.com | Telephone: (503) 667.4564 >>>>>> >>>>>> ---------------------------(end of >>>> broadcast)--------------------------- >>>>>> TIP 3: if posting/reading through Usenet, please send an >> appropriate >>>>>> subscribe-nomail command to majordomo@postgresql.org so that >> your >>>>>> message can get through to the mailing list cleanly >>>>> >>>>> _________________________________________________________________ >>>>> Express yourself with cool new emoticons >>>> http://www.msn.co.uk/specials/myemo >>>>> >>>>> >>>>> ---------------------------(end of >> broadcast)--------------------------- >>>>> TIP 6: Have you searched our list archives? >>>>> >>>>> http://archives.postgresql.org >>>>> >>>> >>> >>> _________________________________________________________________ >>> It's fast, it's easy and it's free. Get MSN Messenger today! >>> http://www.msn.co.uk/messenger >>> >>> >>> ---------------------------(end of broadcast)--------------------------- >>> TIP 4: Don't 'kill -9' the postmaster >>> > > _________________________________________________________________ > Use MSN Messenger to send music and pics to your friends > http://www.msn.co.uk/messenger > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.