dezkit Posted July 13, 2008 Share Posted July 13, 2008 i want to align every field in a table. see image: i want so that Dynamic gaming, section 13, and everyother field to be aligned, as do i want the 16-0, 14-16 and etc. here is my code: <table cellspacing="0" cellpadding="2"> <? $i = 0; while($r = mysql_fetch_array($q)) { $i += 1; $winner = split("-",$r['score']); if($winner[0] > $winner[1]) { $status = "<td class=\"win\">Won</td>"; } else if($winner[0] < $winner[1]) { $status = "<td class=\"loss\">Loss</td>"; } else { $status = "<td class=\"tie\">Tie</td>"; } ?> <tr class="row<?=($i&1)?>"> <td>[<?=$r['team1']?>] <?=$r['team2']?></td> <td class="score"><?=$r['score']?></td> <?=$status?> </tr> <?if($r['info'] != "") { ?> <tr class="row<?=($i&1)?>"> <td colspan="3" class="comments"><i> HLTV Demo: <a href="demos/<?=$r['info']?>">download</a> </i></td> </tr> <? } } ?></table><? } else { echo "We haven't played any matches yet!"; } ?> Link to comment https://forums.phpfreaks.com/topic/114498-solved-align-table-in-php/ Share on other sites More sharing options...
Third_Degree Posted July 13, 2008 Share Posted July 13, 2008 I'm confused, you want it like the image or not like the image? Link to comment https://forums.phpfreaks.com/topic/114498-solved-align-table-in-php/#findComment-588773 Share on other sites More sharing options...
dezkit Posted July 13, 2008 Author Share Posted July 13, 2008 not like the image Link to comment https://forums.phpfreaks.com/topic/114498-solved-align-table-in-php/#findComment-588777 Share on other sites More sharing options...
Third_Degree Posted July 13, 2008 Share Posted July 13, 2008 can you post your css? Link to comment https://forums.phpfreaks.com/topic/114498-solved-align-table-in-php/#findComment-588780 Share on other sites More sharing options...
JasonLewis Posted July 13, 2008 Share Posted July 13, 2008 Try this: <table cellspacing="0" cellpadding="2"> <? $i = 0; while($r = mysql_fetch_array($q)) { $i += 1; $winner = split("-",$r['score']); if($winner[0] > $winner[1]) { $status = "<td class=\"win\">Won</td>"; } else if($winner[0] < $winner[1]) { $status = "<td class=\"loss\">Loss</td>"; } else { $status = "<td class=\"tie\">Tie</td>"; } ?> <tr class="row<?=($i&1)?>"> <td>[<?=$r['team1']?>]</td> <td><?=$r['team2']?></td> <td class="score"><?=$winner[0]?> -</td> <td class="score"><?=$winner[1]?></td> <?=$status?> </tr> <?if($r['info'] != "") { ?> <tr class="row<?=($i&1)?>"> <td colspan="3" class="comments"><i> HLTV Demo: <a href="demos/<?=$r['info']?>">download</a> </i></td> </tr> <? } } ?></table><? } else { echo "We haven't played any matches yet!"; } ?> Of course you'll need to format it a bit more.... Link to comment https://forums.phpfreaks.com/topic/114498-solved-align-table-in-php/#findComment-588781 Share on other sites More sharing options...
dezkit Posted July 13, 2008 Author Share Posted July 13, 2008 nevermind i got it Link to comment https://forums.phpfreaks.com/topic/114498-solved-align-table-in-php/#findComment-588784 Share on other sites More sharing options...
Third_Degree Posted July 13, 2008 Share Posted July 13, 2008 nevermind i got it ok then Link to comment https://forums.phpfreaks.com/topic/114498-solved-align-table-in-php/#findComment-588786 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.