tjverge Posted April 16, 2011 Share Posted April 16, 2011 I have a code that outputs a table but right now each result is under the next ex: 1 2 3 1 2 3 I would like them to be horizontal ex: 123 123 the part of the code the controls the table is: echo "<table border=0 cellspacing=0 cellpadding=0>"; foreach($xml->result->rowset->row AS $name) { echo "<tr>"; echo "<td><img src=/Character/".$name['characterID']."_200.jpg></td></tr>"; echo "<tr><td>".ucwords($name['name'])."</td></tr>"; echo "<tr><td>".ucwords($name['corporationName'])."</td>"; echo "</tr>"; } echo "</table>"; Quote Link to comment https://forums.phpfreaks.com/topic/233864-arranging-table-horizontal/ Share on other sites More sharing options...
sunfighter Posted April 16, 2011 Share Posted April 16, 2011 They're on separate lines because of the <tr>'s. Remove those so it look like this: echo "<tr>"; echo "<td><img src=/Character/".$name['characterID']."_200.jpg></td>"; echo "<td>".ucwords($name['name'])."</td>"; echo "<td>".ucwords($name['corporationName'])."</td>"; echo "</tr>"; Quote Link to comment https://forums.phpfreaks.com/topic/233864-arranging-table-horizontal/#findComment-1202220 Share on other sites More sharing options...
tjverge Posted April 16, 2011 Author Share Posted April 16, 2011 Thanks, that works, guess it's not what I was looking for, I want so say there are 3 things in the xml file I want it so its: <image><image><image> <name><name><name> <corp><corp><corp> Sorry I put it wrong the first time Quote Link to comment https://forums.phpfreaks.com/topic/233864-arranging-table-horizontal/#findComment-1202225 Share on other sites More sharing options...
tjverge Posted April 16, 2011 Author Share Posted April 16, 2011 This is what I came up with it works, but is there a better way to do it? echo "<table border=0 cellspacing=0 cellpadding=0>"; echo "<tr>"; foreach($xml->result->rowset->row AS $name) { echo "<td><img src=http://image.eveonline.com/Character/".$name['characterID']."_200.jpg></td>"; } echo "<tr>"; foreach($xml->result->rowset->row AS $name) { echo "<td>".ucwords($name['name'])."</td>"; } echo "</tr>"; echo "<tr>"; foreach($xml->result->rowset->row AS $name) { echo "<td>".ucwords($name['corporationName'])."</td>"; } echo "</tr>"; } echo "</tr>"; echo "</table>"; Quote Link to comment https://forums.phpfreaks.com/topic/233864-arranging-table-horizontal/#findComment-1202230 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.