From: Gavin M. Roy <gmr@ehpg.net>
To: Yasmine Kedoo <yazkedoo@hotmail.com>
Cc: pgsql-php@postgresql.org
Subject: Re: Parsing Data, Table to Form
Date: Sun, 09 May 2004 08:24:49 -0700
Message-ID: <409E4D41.9090707@ehpg.net> (raw)
In-Reply-To: <BAY14-F8OOSoOvxpVQF0001cb16@hotmail.com>
References: <BAY14-F8OOSoOvxpVQF0001cb16@hotmail.com>
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@postgresql.org so that your
> message can get through to the mailing list cleanly
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: gmr@ehpg.net, yazkedoo@hotmail.com
Subject: Re: Parsing Data, Table to Form
In-Reply-To: <409E4D41.9090707@ehpg.net>
References: <BAY14-F8OOSoOvxpVQF0001cb16@hotmail.com> <409E4D41.9090707@ehpg.net>
* 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