This is my first loop in php...
It is supposed to do the following:
1) Read some images into an array.
2) Create a table
3) Create x number of rows in the table (x = a variable set elsewhere. Right now it is hard coded.)
4) Each new row is to contain one randomly chosen image, from the array that was created in 1).
At the moment, the loop isn't looping!
It only runs one instance of the loop.
So there is only one row created I think, at least only one images is displayed.
(I don't know any way of stepping through php code, so i don't know how to troubleshoot any further!)
What is wrong with this simple loop? It should run 4 times because of the hardcoded values.
<?php
$images=array('vulgare.png', 'blueberry.png' ,'kantarell.png',);?>
<?php echo "<table class=\"sidebartable\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" >";
for ($counter = 0;
$counter <= 4;
$counter += 1);
$rand=rand(0,3);
$image=$images[$rand];
{echo "<tr><td>";
echo"<img src=$image>";
echo "</td></tr>";}
?>
</table>