If I create a simple function
function clothtable($clothgroup){
echo $clothgroup;
}
clothtable('F30');
I get F30 on the screen.
If I do much the same with a function involving a database
function clothtable($brand, $clothgroup){
$query = "SELECT thumb, popup FROM Web_images WHERE brand = '$brand' AND clothgroup = '$clothgroup' ORDER BY id" ;
$result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());
// count number of rows in database
$row_count = mysql_num_rows($result);
//check if there is a remainder after rows divided by 6
$remainder=$row_count%6;
//no of extra cells required to make up last row
$extracells=6-$remainder;
echo $clothgroup;
echo "<table>\n<tr>\n";
while($row = mysql_fetch_array($result))
{
if ($i && $i%6==0 )
echo "</tr>\n<tr>\n";
echo "<td>". $row['thumb']." ".$row['popup']."</td>\n";
$i++;
}
if ($extracells >0)
echo "<td colspan=".$extracells."> </td>;\n";
echo "</tr>\n</table><br>\n";
}
clothtable('Somebrand', 'F30');
I get F30; above the table - ie an unwanted ';' appears. Why so, do you think?