I'm getting a parse error on line 20 - if ($x % 4 = 0) {
For those who don't know, % is for modulus division (remainder division). Anyone see why I'm getting a parse error?
For those who don't know, % is for modulus division (remainder division). Anyone see why I'm getting a parse error?
PHP:
<table width="562" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width=220 align="left" bgcolor="#FFFFFF">
pic
</td>
<td width=342 align="left" bgcolor="#FFFFFF">
<table width="342" border="0" cellspacing="0" cellpadding="0">
<tr>
<?php
/* VARIABLES:
$num_pics = number of pictures in teh folder
$x = a counter
$file_base = filename without the 3-digit number extension */
$num_pics = 71;
$file_base = "images/Whitby/Hockey/Atom AAA/2003-2004/thumbnails/atomaaa";
$x = 1;
if ($num_pics >= $x) {
if ($x % 4 = 0) {
echo "<td width=75><img src='" . $file_base . leading_zero($x, 3, 0) . ".jpg' alt='Thumbnails' border=0></td>" . "<td width=15>ย </td></tr><tr>"; //print with new row
$x++; //increase pic #
}
else {
echo "<td width=75><img src='" . $file_base . leading_zero($x, 3, 0) . ".jpg' alt='Thumbnails' border=0></td>" . "<td width=15>ย </td>"; //print without new row
$x++;
}
else {
$x--; //x is now one greater than the number of files, so bump it down
$y = 4 - ($x % 4); //find the number of empty rows that need filling
while ($y > 0 ) {
echo "<td width=75>ย </td><td width=15>ย </td>";
$y--;
}
}
?>
</tr>
</table>
</td>
</tr>
</table>
<?php
function leading_zero( $aNumber, $intPart, $floatPart=NULL, $dec_point=NULL, $thousands_sep=NULL) { //Note: The $thousands_sep has no real function because it will be "disturbed" by plain leading zeros -> the main goal of the function
$formattedNumber = $aNumber;
if (!is_null($floatPart)) { //without 3rd parameters the "float part" of the float shouldn't be touched
$formattedNumber = number_format($formattedNumber, $floatPart, $dec_point, $thousands_sep);
}
//if ($intPart > floor(log10($formattedNumber)))
$formattedNumber = str_repeat("0",($intPart + -1 - floor(log10($formattedNumber)))).$formattedNumber;
return $formattedNumber;
}
?>













