tags:

views:

21

answers:

1

Hello

How would you display / Echo pictures with a name underneeth in the order shown on the example below in php ? Sort of like echoing a friends list. Im looking for how to structure it with code, I guess thats the correct way to explain what I want to achieve, hope that helps.

I tried

echo '
    <tr>
        <td align=\"center\">
            <img src=\"hello.png\" alt=\"My Picture\" /><br /> Name
        </td>
    </tr>
    ';

but that still does not quite work

What i want to acheive,

Example Picture

Sorry for the bad explanation, any help and examples would be helpful

Thanks!

+2  A: 

You need to count how many images you've echoed in your loop, if it's 4 images, echo a </tr><tr>

$td_count = 0;
$len = 50;

echo '<table border="1"><tr>';

while ($td_count <= $len)
{
  if (!($td_count % 4)) echo '</tr><tr>';

  echo '<td align=\"center\">cell '.$td_count.'</td>';

  $td_count++;

}
echo '</tr></table>'
Gary Green