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 F15E2D1B1AD for ; Mon, 17 May 2004 09:15: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 63613-09 for ; Mon, 17 May 2004 09:15:41 -0300 (ADT) Received: from mail.exemail.com.au (mx2.exetel.com.au [220.233.0.3]) by svr1.postgresql.org (Postfix) with SMTP id 3C944D1B193 for ; Mon, 17 May 2004 09:15:34 -0300 (ADT) Received: (qmail 29817 invoked by uid 0); 17 May 2004 12:15:34 -0000 Received: from unknown (HELO exemail.com.au) (Paul.Lynch@exemail.com.au@220.233.5.231) by aich.exetel.com.au with SMTP; 17 May 2004 12:15:34 -0000 Message-ID: <40A8AE2C.4000504@exemail.com.au> Date: Mon, 17 May 2004 22:21:00 +1000 From: Paul Lynch User-Agent: Mozilla/5.0 (Windows; U; Win95; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-php@postgresql.org Subject: Re: Parsing Data, Table to Form References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests=HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200405/31 X-Sequence-Number: 2750 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 "

Error in getting information from table

"; // 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. Yasmine Kedoo wrote: > Hey Paul. > > Yes, the error is exactly that :-). I've put in the following code on > admininfo.php: > > else > { > > $row = pg_fetch_object($result, 0); > > $test = ""; > > for ($rw = 0; $rw < $maxrows; $rw++) > { > > echo " "; > > for ($fld = 0; $fld < $maxfields ; $fld++) > > { > > > /*echo " class=\"tabletext\" height=\"38\">"; > > > echo ""; > echo $test .= pg_Result($result,$rw,$fld);*/ > > echo pg_Result($result,$rw,$fld); > > } > > /*echo " height=\"38\"> ";*/ > > > pg_result($result,0,$adid); > echo "
\n"; > echo " name=\"adid\"value=\"$adid\" >"; > echo " name=\"name\"value=\"$name\" >"; > echo " name=\"surname\"value=\"$surname\" >"; > echo " name=\"phone\"value=\"$phone\" >"; > echo " name=\"email\"value=\"$email\" >"; > echo " name=\"username\"value=\"$username\" >"; > echo " name=\"password\"value=\"$password\" >"; > echo " name=\"building\"value=\"$building\" >"; > echo " name=\"postcode\"value=\"$postcode\" >"; > echo ""; > echo "
"; > } > } > > and on page updaad.php, the error: > > Warning: Unable to jump to row 0 on PostgreSQL result index 2 in > /home/webpages/yamkedoo/Project/updaad.php on line 66 > > is displayed, along with empty textfields. The relevant code for > updaad.php is as follows: > > $adid = $_POST['adid']; > $name = $_POST['name']; > $surname = $_POST['surname']; > $phone = $_POST['phone']; > $email = $_POST['email']; > $username = $_POST['username']; > $password = $_POST['password']; > $building = $_POST['building']; > $postcode = $_POST['postcode']; > > $rowtoupdate = pg_exec($database, "SELECT adid, name, sur, > phone, email, username, password, building, postcode FROM admininfo > WHERE adid='$adid'"); > > list($formadid, $formname, $formsurname, $formphone, $formemail, > $formusername, $formpassword, $formbuilding,$formpostcode) = > pg_fetch_row($rowtoupdate, 0); > > echo "
\n"; > echo "Admin ID Number: value=\"$formadid\">
\n"; > echo "Name: value=\"$formname\">
\n"; > echo "Surname: value=\"$formsurname\">
\n"; > echo "Phone: value=\"$formphone\">
\n"; > echo "Email: value=\"$formemail\">
\n"; > echo "Username: value=\"$formusername\">
\n"; > echo "Password: value=\"$formpassword\">
\n"; > echo "Building: value=\"$formbuilding\">
\n"; > echo "Postcode: value=\"$formpostcode\">
\n"; > echo "
"; > echo ""; > echo "
"; > > I am not too sure how to fix the error on page admininfo.php. Any > ideas? It doesn't seem to be parsing the data to the textfields. > > Thanx again, > > Yasmine > > >> From: Paul Lynch >> To: Yasmine Kedoo , pgsql-php@postgresql.org >> Subject: Re: [PHP] Parsing Data, Table to Form >> Date: Sun, 16 May 2004 22:14:15 +1000 >> >> Hi Yasmine, >> >> Could you post line 66 or point out which line is 66 in updaad.php. >> From the error message I would expect it to contain something like: >> pg_fetch_row($rowtoupdate, 0) >> >> From your code, if this failed it would be before the display of data >> in the form, and not after you click the update button. Which has me >> a little perplexed. In fact I would expect clicking on the update >> button to start loading program adupdate.php >> as per instructions in this line: >> echo "
\n"; >> So unless this error was hidden somehow by the form and then >> displayed after the click of update button, but that doesn't fit with >> my knowledge of browser behaviour. >> >> I am hoping the content on line 66 and a bit above and below it can >> help relate the error message to the code. >> >> Paul >> >> Yasmine Kedoo wrote: >> >>> but when i click the submit button on updaad.php, i'm getting the >>> following error : >>> >>> Warning: Unable to jump to row 0 on PostgreSQL result index 2 in >>> /home/webpages/yamkedoo/Project/updaad.php on line 66 >>> >>> and nothing is being parsed to the textfields on adupdate.php >>> (writeat.php). >>> >>> Do u know wat the problem may be? :-) >>> >>> Thanx again, your help is much appreciated >>> >>> Yasmine >> >> >> > > _________________________________________________________________ > Use MSN Messenger to send music and pics to your friends > http://www.msn.co.uk/messenger > > >