<TABLE WIDTH="100%" HEIGHT="100%">
<?php
$db = mysql_connect ('localhost') or die ($MYSQL_NO_CON);
mysql_select_db ('database_name',$db) or die ($MYSQL_NO_BD);
$query = "SELECT * FROM table" or die ($MYSQL_NO_QUERY);
$result = mysql_query($query);
if (mysql_num_rows($result) > 0 ) {
$num_rows = mysql_num_rows($result);
for ($i=0; $i <$num_rows; $i++) {
$row = mysql_fetch_row($result);
echo "<TR><TD>$row[0]</TD></TR>;
}
}else echo "no records found!";
?>
</TABLE>
Rui Cunha
Philip Thompson writes:
Hi all!
I am using a select statement to obtain all the dates whenever someone submitted a problem in a database. Well, I want to get the result (which could be multiple dates) and then print that in a table format with some other information on a webpage. So I want to use a FOR loops and go through each of the dates and dynamically create a table.
My question is: how do I store the results of the select query? Would I want to store them in an array, and then just parse through each element of the array, and what is the syntax for that? Or is there a better way?
Thanks,
~Philip
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php