onthespot Posted August 16, 2009 Share Posted August 16, 2009 Ok so I posted this in HTML, but got no replies and thought it may be something to do with the PHP side of things. <table><tr><td> <b><u>Awards:</u></b></td></tr> <tr><td><br> <?php function awards($type) { $images = array ( 'league1' => 'first.jpg', 'league2' => 'second.jpg', 'league3' => 'third.jpg' ); if(array_key_exists($type, $images)) return '<img src="images/awards/'.$images[$type].'" width="12" height="27" />'; return false; } $awarduser = mysql_real_escape_string($req_user_info['username']); $res=mysql_query("SELECT * FROM ".TBL_AWARDS." WHERE awarduser = '$awarduser' ORDER BY awarddate"); while($row=mysql_fetch_assoc($res)){ $type=$row['awardtype']; echo awards($type); } ?> </td></tr> </table> Each award should be displayed across the page, right? But at the moment each award just goes below the one above. How can i correct this? Quote Link to comment https://forums.phpfreaks.com/topic/170491-php-layout/ Share on other sites More sharing options...
ignace Posted August 16, 2009 Share Posted August 16, 2009 HTML: <div id="awards"> <ul> <li><img src="images/awards/first.jpg" width="12" height="27" /></li> <li><img src="images/awards/second.jpg" width="12" height="27" /></li> <li><img src="images/awards/third.jpg" width="12" height="27" /></li> </ul> </div> CSS: #awards { display: block } #awards ul li { display: inline } Quote Link to comment https://forums.phpfreaks.com/topic/170491-php-layout/#findComment-899352 Share on other sites More sharing options...
onthespot Posted August 16, 2009 Author Share Posted August 16, 2009 That lists then. I am after them going 1 2 3 4 5 6 7 8 , rather than 1 2 3 4 5 6 7 8 any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/170491-php-layout/#findComment-899354 Share on other sites More sharing options...
onthespot Posted August 16, 2009 Author Share Posted August 16, 2009 At the moment, the echo is for one and then it goes down and does it again on the next line, how can i get 10 per line, before going down to the next 10 underneath? Quote Link to comment https://forums.phpfreaks.com/topic/170491-php-layout/#findComment-899355 Share on other sites More sharing options...
onthespot Posted August 16, 2009 Author Share Posted August 16, 2009 How can I put <td> tags around this echo awards($type); That might sort this for me? Quote Link to comment https://forums.phpfreaks.com/topic/170491-php-layout/#findComment-899360 Share on other sites More sharing options...
onthespot Posted August 16, 2009 Author Share Posted August 16, 2009 <td><? echo awards($type);?></td> I did that and now have them going horizontally. However, they are just running off my page and going far to far to the right? Quote Link to comment https://forums.phpfreaks.com/topic/170491-php-layout/#findComment-899364 Share on other sites More sharing options...
onthespot Posted August 16, 2009 Author Share Posted August 16, 2009 Can anybody help me on this, its driving me nuts Quote Link to comment https://forums.phpfreaks.com/topic/170491-php-layout/#findComment-899366 Share on other sites More sharing options...
ignace Posted August 16, 2009 Share Posted August 16, 2009 That lists then. I am after them going 1 2 3 4 5 6 7 8 , rather than 1 2 3 4 5 6 7 8 any ideas? That's why you need the CSS this will put them next to each other. You can atleast try the solutions we provide. Quote Link to comment https://forums.phpfreaks.com/topic/170491-php-layout/#findComment-899375 Share on other sites More sharing options...
onthespot Posted August 16, 2009 Author Share Posted August 16, 2009 I did dude it didnt list like i will try again Quote Link to comment https://forums.phpfreaks.com/topic/170491-php-layout/#findComment-899384 Share on other sites More sharing options...
onthespot Posted August 16, 2009 Author Share Posted August 16, 2009 I have tried the list and that doesnt work? Anyone else got any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/170491-php-layout/#findComment-899476 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.