This part of code
$imagesperrow=2;
$imagesperrow=$value
echo '<img src="'.$value.'">';
beside of having an error (you need ; after second line) it does the following:
- set variable $imageperrow to 2
- set variable $imageperrow to value of the variable $value
- echo the $value as a picture
I don't get what you tried here but if you need the pictures to show in rows of two pictures you should try something like this:
Implement an index variable like $ind and set it to 0, then in the foreach loop for every picture that is shown do $ind++;
When showing a pictures use table like this
before foreach loop set table:
echo "<table>";
inside foreach loop set how the pictures are shown:
if($ind%2==0){//$ind is 0, 2, 4...
echo "<tr><td>";
echo '<img src="'.$value.'">';
}
else{//$ind is 1, 3, 5...
echo "</td><td>";
echo '<img src="'.$value.'"></td></tr>';
}
and after foreach loop close table tag:
echo "</table>";
I didn't tested this code but it seems to me like t could work, well anyway you get my idea...
Any problem you just let me know...