Hi,
I am very new to PHP and this is driving me crazy. Im trying to display a product using a while loop. I would like it to display a new row every 4 entries and I would like to keep my while loop. I am so close. I know it involves an if statement in the while loop; something like this:
if ($i%4 == 0)
{
print "<br/>";
}
The only problem is I can't get my syntax right. Argh!
Any help would be greatly appreciated.
Here is the part of my code giving me problems:
// Display all the URLs.
$result = mysql_query ($query);
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {
//Display each record.
echo "
<td bgcolor=\"#ffffff\" colspan=\"1\" width=\"689\" height=\"154\" valign=\"top\" align=\"left\"><a href=\"view_print.php?pid={$row['product_id']}\"><img src=\"uploads/{$row['image_name']}\" $image[3] alt=\"{$row['item_name']}</a></td>
<br/>
<td align=\"left\">\${$row['price']}</td> ";
}
echo '</table>'; // Close the table.
mysql_close(); // Close the database connection.
include_once ('footer.html'); // Require the HTML footer.
?>