Send user photo submission into a table row

images php coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
php-forum Fan User
php-forum Fan User
Posts: 974
Joined: Mon Oct 01, 2012 12:32 pm

Mon Feb 25, 2013 1:06 pm

1. please use [ code ] tags (without spaces) to make your code a little easier to read. It's also best to avoid going back and forth from html to php multiple times, for a number of reasons.

2. your second block that you say is working is actually using a static value, rather than the dynamic value you say is not working in the 3rd.

3. the $row variable is on its very last iteration, or empty, by the time it would be called in the second or 3rd section. The only statement actually being looped is the <img src= line.

Try this, it is untested because i started with just your fragment.

Code: Select all


echo '<div style="float:Left;">';
echo '<table border=2>';

echo '<tr><td>';
while ($row = mysql_fetch_array($res)) {
    echo '<img src="' . $row['path'] . '" width="300px" height="200px"/>';
    echo '</td>
<a href="images/2.jpg"><img src="' . $row['path'] . '" width="300px" height="200px" alt=""/></a>

    echo '<a href="images/cat.jpg"><img src="' . $row['path'] . '" width="300px" height="200px" alt=""/></a>';
    echo '
echo '</table>';

Post Reply