Jump to content

[SOLVED] align table in php


dezkit

Recommended Posts

i want to align every field in a table.

see image:

2lcp76.jpg

 

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.