Re: Parsing Data, Table to Form

From: "Gavin M(dot) Roy" <gmr(at)ehpg(dot)net>
To: Yasmine Kedoo <yazkedoo(at)hotmail(dot)com>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: Parsing Data, Table to Form
Date: 2004-05-09 15:24:49
Message-ID: 409E4D41.9090707@ehpg.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

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(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

In response to

Browse pgsql-php by date

  From Date Subject
Next Message brew 2004-05-09 15:38:35 Re: Parsing Data, Table to Form
Previous Message Yasmine Kedoo 2004-05-09 14:05:20 Parsing Data, Table to Form