Jump to content

how to fix this division


cmb

Recommended Posts

The code is suppose to put 6 pics in a row then move to the next line. What happens is the first line only has 5 pics and all the rest have 6. How do i fix this

<?php
$c_query = "SELECT * FROM products WHERE Type='Candy' ORDER BY Price";
$c_results = mysql_query($c_query) or die(mysql_error());
$c = 1;
while ($c_row = mysql_fetch_array($c_results)){
if($c %6 == 0){
	echo "</tr><tr>";
	echo "<td><center><img src='" . $c_row['Path'] . "' width='50' height='50' /></center>";
	echo "<br /><center><p>" . $c_row['Product'] . " $" . $c_row['Price']. "</p></center></td>";
	$c++;
}else{
	echo "<td><center><img src='" . $c_row['Path'] . "' width='50' height='50' /></center>";
	echo "<br /><center><p>" . $c_row['Product'] . " $" . $c_row['Price']. "</p></center></td>";
	$c++;	
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/265735-how-to-fix-this-division/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.