Trouble with Tables
Posted: Sun Dec 26, 2010 9:22 pm
Greetings all please forgive me for I am just beginning with php. My immediate problem is trying to get the below output to result in a table with the 2 cells for each field side by side. I can't get the printf line formatted correctly. Any help?
$result = mysql_query(
"SELECT * FROM `units` ORDER BY `field_1` ASC LIMIT 0, 30 ");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
exit();
}
while ( $row = mysql_fetch_array($result) ) {
printf("<P>" . " %s %s", $row["field_1"], $row["field_2"] . "</P>");
}
$result = mysql_query(
"SELECT * FROM `units` ORDER BY `field_1` ASC LIMIT 0, 30 ");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
exit();
}
while ( $row = mysql_fetch_array($result) ) {
printf("<P>" . " %s %s", $row["field_1"], $row["field_2"] . "</P>");
}