Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

Send user photo submission into a table row

images php coding issues or problems here.

Moderators: macek, egami, gesf

Send user photo submission into a table row

Postby lola123 » Tue Feb 05, 2013 7:53 am

I would like to modify my code so when a user uploads an image it appears in the table on my Gallery page. This space in the table once clicked becomes a slideshow.

At the moment I can get the submitted photos to appear but I can't get them into the Jquery Lightbox method that i've applied, which is the slideshow feature.

Anyone know how to fix this ?



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

<tr>
<td>
<?php while ($row=mysql_fetch_array($res)){?><img src="<?php echo $row['path']?>" width="300px" height="200px"/> <br> <<<<<<<<<<THIS IS WORKING<<<<<<<<<< <?php }?>
</td>
</tr>

<tr>
<td>
<a href="images/2.jpg"><img src="images/2.jpg" width="300px" height="200px" alt=""/></a>
<<<<<<<<<<THIS IS WORKING<<<<<<<<<< </td>
</tr>

<tr>
<td>
<a href="images/cat.jpg"><img src="<?php echo $row['path']?>" width="300px" height="200px" alt=""/></a> <<<<<<<<<<THIS IS THE CODE NOT WORKING<<<<<<<<<<

</td>
</tr>

</table>
lola123
New php-forum User
New php-forum User
 
Posts: 1
Joined: Tue Feb 05, 2013 7:43 am

Re: Send user photo submission into a table row

Postby seandisanti » 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

<?php

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>
</tr>
<tr>
<td>
<a href="images/2.jpg"><img src="' 
$row['path'] . '" width="300px" height="200px" alt=""/></a>
</td>
</tr>

<tr>
<td>'
;
    echo 
'<a href="images/cat.jpg"><img src="' $row['path'] . '" width="300px" height="200px" alt=""/></a>';
    echo 
'
</td>
</tr>'
;
}
echo 
'</table>';
 
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron