note 31467 added to function.pg-query
| From: | yoshinariatsuo at yahoo dot com | Date: | Wed, 23 Apr 2003 04:59:04 +0000 |
| Subject: | note 31467 added to function.pg-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-46963@lists.php.net to get a copy of this message | ||
create table from pg_query results.. hope it helps newbies...
function table_create($result)
{
$numrows = pg_num_rows($result);
$fnum = pg_num_fields($result);
echo "<table border width='100%'>";
echo "<tr>";
for ($x = 0; $x < $fnum; $x++) {
echo "<td><b>";
echo strtoupper(pg_field_name($result, $x));
echo "</b></td>";
}
echo "</tr>";
for ($i = 0; $i < $numrows; $i++) {
$row = pg_fetch_object($result, $i);
echo "<tr align='center'>";
for ($x = 0; $x < $fnum; $x++) {
$fieldname = pg_field_name($result, $x);
echo "<td>";
echo $row->$fieldname;
echo "</td>";
}
echo"</tr>";
}
echo "</table>";
return 0;
}
--
http://www.php.net/manual/en/function.pg-query.php
http://master.php.net/manage/user-notes.php?action=edit+31467
http://master.php.net/manage/user-notes.php?action=delete+31467
http://master.php.net/manage/user-notes.php?action=reject+31467