Re: Parsing Data, Table to Form

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



Look at these functions in the php documentation:

pg_Query, pg_NumRows, pg_Fetch_Object, and pg_FreeResult

http://www.php.net/manual/en/ref.pgsql.php

Small example

$conn = pg_Connect("host=localhost dbname=test user=postgres");
$result = pg_Query($conn, "SELECT * FROM mytable ORDER BY id LIMIT 1 OFFSET 0;");
$rows = pg_NumRows($result);
if ( $rows == 0 )
 echo "Sorry no data found.\n";
else {
 $data = pg_Fetch_Object($result, 0);
 pg_FreeResult($result);
 echo "<form method=post action=myaction.php>\n";
echo "Field 1: <input type=text name=\"field1\" value=\"$data->field1\"><br />\n"; echo "Field 2: <input type=text name=\"field2\" value=\"$data->field2\"><br />\n"; echo "Field 3: <input type=text name=\"field2\" value=\"$data->field3\"><br />\n";
 echo "<input type=submit value=update></form>\n";
}



Yasmine Kedoo wrote:

Hi.

I have done a search on one of my PHP pages, and displayed the results in a table on another page.

Then when a button is clicked, i want to be able to display the table information in editable form fields, so that the data may be altered and the database updated.

Does anyone have any ideas how i may be able to carry this out? :-) It's the parsing the data that i am unable to do.

Thanx Again

Yaz

_________________________________________________________________
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@xxxxxxxxxxxxxx so that your
     message can get through to the mailing list cleanly




[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