Reply to Re: populate a dinamic table with two different querys.

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация