|
Posted by Toby Inkster on 11/19/49 11:47
Chifo wrote:
> but, data in html first part,it's gone away.
> how can i put on html table data from two querys in same table?
<?php
$table1 = "<table>\n"
. "<caption>15:30 and earlier</caption>\n"
. "<tr><th>Time</th><th>Thingy</th></tr>\n";
$table2 = "<table>\n"
. "<caption>15:31 and later</caption>\n"
. "<tr><th>Time</th><th>Thingy</th></tr>\n";
$results = pg_query($db, "SELECT time,thingy FROM mydata ORDER BY thingy;");
while($row = pg_fetch_assoc($results))
{
$time = strtotime($row['time']);
$trow = sprintf("<tr><td>%s</td><td>%s</td></tr>\n"
,htmlentities(date('H:m', $time))
,htmlentities(substr($row['thingy'], 0, 200))
);
if (date('Hm', $time) > 1530)
$table1 .= $trow;
else
$table2 .= $trow;
}
$table1 .= "</table>\n";
$table2 .= "</table>\n";
print $table1."<hr>\n".$table2;
?>
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
[Back to original message]
|