I've been trying to troubleshoot this all day. Arg! 🙂
I have a while loop which outputs images, everything works great, but my html formatting output is slightly off (yes I'm a newbie). The first line looks perfect, but the second line drops to the middle of the page instead of right below the first line. Should look like this:
xxxx
xxxx
but looks like this:
xxxx
xxxx
Here is the code:
if (isset($_GET['aid'])) {
$query = "SELECT * FROM category, product WHERE category.category_id = product.category_id AND category.category_name='Fish' AND product.category_id = {$_GET['aid']} ORDER BY product.item_name";
} else {
$query = "SELECT * FROM category, product WHERE category.category_id = product.category_id AND category.category_name='Fish' ORDER BY category.category_name ASC, product.item_name ASC";
}
echo '<body bgcolor="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table id="Table_01" width="801" link="#ffffff" height="651" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor ="#fffff">
<td rowspan="6">
<img src="images/links_01.jpg" width="113" height="651" alt=""></td>
';
// Display all the URLs.
$rowNum = 0;
$result = mysql_query ($query);
//echo "<table><tr>";
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
if($rowNum > 3)
{
$rowNum = 0;
echo "<tr>";
}
//Display each record.
echo "<td bgcolor='#ffffff' rowspan='2' colspan='0' border='0' width='691' height='154' valign='top' align='left'><a href='view_print.php?pid=".$row['product_id']."'><img src='uploads/".$row['image_name']."' alt='".$row['item_name']."'></a><br /><div align='left'>\$".$row['price']."</div></td>";
$rowNum++;
}
echo '</tr></table>';
I believe the problem is my while statement is not recognizing that I have 6 rows in my side column which is <td rowspan="6"><img src="images/links_01.jpg" width="113" height="651" alt=""></td>
If I'm not mistaken this needs to be in the while statement to be recognized. Is this correct? If so what is the proper syntax to do this?
Please let me know if you need any other info. Thank you so much!