From: Paul Lynch <paul.lynch@exemail.com.au>
To: pgsql-php@postgresql.org
Subject: Re: Parsing Data, Table to Form
Date: Wed, 19 May 2004 14:59:24 +1000
Message-ID: <40AAE9AC.3070506@exemail.com.au> (raw)
In-Reply-To: <BAY14-F15SQeSOzNCWb0005df76@hotmail.com>
References: <BAY14-F15SQeSOzNCWb0005df76@hotmail.com>
Hi Yasmine,
Just noticed a mistake in the error checking. I typed :
if ( ! pg_numrows($rowstoupdate) == 1 ) // expecting a single
row only
however $rowstoupdate should be $rowtoupdate - take out the 's' .
That will hopefully catch the lack of rows. Now the real problem lies
in the pg_exec statement. It is not getting the data from the table.
And its problem is possibly in the $database connection value. You
should have somewhere before the pg_exec a line like:
$database=pg_connect("dbname=your_db user=your_user");
The error that displays is not the cause of the error, it is back up in
the code that you need to look.
Hopefully you will find the missing or wrong piece up there.
It is also a good practice to include lots of error checks in your
program to help isolate where things are going wrong. It is also good
not to make typing errors when writing error checks :-[ as I did.
HTH
Paul
Yasmine Kedoo wrote:
> Hey Paul.
>
> I've actually used CHAR for the id, as it involves both numbers and
> letters. That's y i actually left the single inverted commas around
> $adid, '$adid'.
>
> So i too am confused as to why the code doesn't work. Can't put my
> finger on the problem at the mo, but still get the same error.
>
> Warning: Unable to jump to row 0 on PostgreSQL result index 2 in
> /home/webpages/yamkedoo/Project/updaad.php on line 66
>
> I've added ur suggestion, but still the same thing. If u could help
> any further, that would be great :-)
>
> Thanx again,
>
> Yasmine
>
>
>
>
>
>
>> From: Paul Lynch <paul.lynch@exemail.com.au>
>> To: pgsql-php@postgresql.org
>> Subject: Re: [PHP] Parsing Data, Table to Form
>> Date: Mon, 17 May 2004 22:21:00 +1000
>>
>> Hi Yasmine,
>>
>> A lack of error checking has caught us out here. Plus some syntax in
>> the select and where clause. The adid in admininfo table is an
>> integer, and I gave you code for using a character type key. So
>> change ... WHERE adid='$adid' to WHERE adid=$adid (drop the ' )
>> While there you could add some error condition checking like below:
>>
>> $rowtoupdate = pg_exec($database, "SELECT adid, name, sur, phone,
>> email, username, password, building, postcode FROM
>> admininfo WHERE adid=$adid");
>> if ( ! pg_numrows($rowstoupdate) == 1 ) // expecting a
>> single row only
>> {
>> echo "<h2>Error in getting information from table</h2>";
>> // add whatever you want here to help you see what went wrong
>> } else{
>> list($formadid, $formname, $formsurname, $formphone,
>> $formemail, $formusername,
>> $formpassword,
>> $formbuilding,$formpostcode) = pg_fetch_row($rowtoupdate, 0);
>> }
>>
>> Keep going you're getting close.
>>
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: paul.lynch@exemail.com.au
Subject: Re: Parsing Data, Table to Form
In-Reply-To: <40AAE9AC.3070506@exemail.com.au>
References: <BAY14-F15SQeSOzNCWb0005df76@hotmail.com> <40AAE9AC.3070506@exemail.com.au>
* 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