cant get user names to display at top of picture

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

Post Reply
toasty525
Forum Newbie
Posts: 10
Joined: Wed Apr 05, 2006 12:48 pm

cant get user names to display at top of picture

Post by toasty525 »

Hi, im trying to display pictures side by side in a table with the picture owners name above them using the following code:

Code: Select all

$tmp=mysql_query("SELECT id,fname,pic1 FROM ".C_MYSQL_MEMBERS." WHERE fname = '".$link."' AND pic1 <> 0 limit 1");
while($i=mysql_fetch_array($tmp)) {
$name = (trim($i['fname']) == '') ? $i['id'] : $i['fname'];
$pic = ($i['pic1']); ?>
<a href="view.php?l=<?=$l;?>&id=<?=$i['id'];?>"><b><?=$name;?></b></a>
<a href="../view.php?l=<?=$l;?>&id=<?=$i['id'];?>"><img src=/members/uploads/<?="$pic";?> border="0" width="100"></a><? }}
?>
It displays the pictures fine but the names are along side the pictures instead of above any ideas why this is happening ? thanks, mark.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Add a <br> after the first anchor?
toasty525
Forum Newbie
Posts: 10
Joined: Wed Apr 05, 2006 12:48 pm

Post by toasty525 »

Adding a <br> puts the names above the pictures but also makes the pictures display one above the other instead of my desired effect wich is to have the pictures display along side one another.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

toasty525
Forum Newbie
Posts: 10
Joined: Wed Apr 05, 2006 12:48 pm

Post by toasty525 »

Thanks for the link Ambush Commander it done the job perfectly, nice article. :)
Post Reply