PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
hward
Forum Contributor
Posts: 107 Joined: Mon Apr 19, 2004 6:19 pm
Post
by hward » Thu Aug 25, 2005 11:57 am
I am trying to get my returns to display an image in a table with the name below it in a cell and have them side by side instead of below each other, This is the code I have that displays the image name and name side by side but I can't figure out how to get it to do it in a table.
Code: Select all
while($row = mysql_fetch_array($result))
{
echo $row[image].'--'.$row['name'].' ';
}
echo '<br>';
echo '<br>';
echo '<br>';
I was wondering if you could just return something like this
Code: Select all
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="17%" height="171">
<tr>
<td width="100%" height="132">
<p align="center">
<img border="0" src="image.jpg" width="172" height="175"></td>
</tr>
<tr>
<td width="100%" height="38">
<p align="center">Name</td>
</tr>
</table>
Stewsburntmonkey
Forum Commoner
Posts: 44 Joined: Wed Aug 24, 2005 2:09 pm
Post
by Stewsburntmonkey » Thu Aug 25, 2005 12:24 pm
That should work as a template. However the <td> tag can take the align attribute (or better yet use style/css) so there is no need for the <p> tags.
hward
Forum Contributor
Posts: 107 Joined: Mon Apr 19, 2004 6:19 pm
Post
by hward » Thu Aug 25, 2005 12:49 pm
this gets me close but just puts the name on the right of the image
Code: Select all
while($row = mysql_fetch_array($result))
{
// echo $row['stock_num'].'--'.$row['gender'].' ';
echo "
<td width='130' height='132'>
<align='center'>
<img border='0' src='1.jpg' width='130' height='132'></td>
</tr>
<tr>
<td width='170' height='38'>
<align='center'>Name</td>
</tr>
";
}
Stewsburntmonkey
Forum Commoner
Posts: 44 Joined: Wed Aug 24, 2005 2:09 pm
Post
by Stewsburntmonkey » Thu Aug 25, 2005 12:53 pm
You forgot the opening <tr> tag. Also <td align="center"> will work, its deprecated, but less so than the <align> tag.