[SOLVED]html tables using php help needed
Posted: Thu Sep 22, 2005 12:58 pm
Hi,
I am trying to get the results of my query to print into an html table with 4 columns, how do I do that??
Example:
Here is my code:
I am trying to get the results of my query to print into an html table with 4 columns, how do I do that??
Example:
Code: Select all
item 1 item 2 item 3 item 4
image image image image
item 5 item 6 item 7 item 8
image image image imageCode: Select all
<table border="0" cellspacing="0" cellpadding="0">
<tr><td>
<?php
require_once('product_inc_fns.php');
session_start();
$conn = db_connect();
// ---- END CONFIGURATIONS ------------------------------------------//
if ($name == "")
{$name = '%';}
$result = mysql_query ("SELECT * FROM products WHERE name LIKE '%$name%' ORDER by name");
if ($row = mysql_fetch_array($result)) {
do {
$url = 'show_product.php?name='.($row['name']);
$title = '<font face="Verdana" size="2">' . $row['name'].' </font>';
do_html_url($url, $title);
if (@file_exists('images/uploads/thumbnails/'.$row['image'].'.jpg'))
{
$title = '<img src=\'images/uploads/thumbnails/'.($row['image']).'.jpg\' border=0>';
do_html_url($url, $title);
}
else
{
echo ' ';
}
echo "<b> </b> ";
echo '</td><td>';
}
while($row = mysql_fetch_array($result));
}
else
{
print "Sorry, no records were found!";
}
echo '</td><td>';
?>
</td></tr></table>