You are here: Re: Newbie: How to display query result in table? « PHP Programming Language « IT news, forums, messages
Re: Newbie: How to display query result in table?

Posted by NC on 07/06/06 04:52

Huevos wrote:
>
> I scanned through hundreds of posts and tried several variations
> on some promising posts, but have not succeeded yet...

Did you try PHP documentation? There's an example of what you want
there:

http://www.php.net/mysql

> All I want to do (to start) is have a web page display a table
> of the result of a query.

You're almost there. Change a couple of things like this:

<HTML>
<HEAD>
</HEAD>
<BODY>
<?php
// DATABASE QUERY
$bamboo = 'SELECT * FROM `Varieties` WHERE 1 ' .
'ORDER BY `nHeight` DESC, `nDiameter` DESC, `nMinTemp` ASC, ' .
' `tSun` DESC LIMIT 0, 30 ';
$result = mysql_query($bamboo);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php
while ($record = mysql_fetch_row($result)) {
echo "<tr>\r\n";
foreach ($record as $field) {
echo "<td>$field</td>\r\n";
}
echo "</tr>\r\n";
}
?>
</table>
</BODY>
</HTML>

Cheers,
NC

 

Navigation:

[Reply to this 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

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