Re: Parsing Data, Table to Form

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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@xxxxxxxxxxxxxx>
To: pgsql-php@xxxxxxxxxxxxxx
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.




[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux