Jump to content

[SOLVED] php limit


dezkit

Recommended Posts

is it possible so that if Team2 has a name of more than 4, so that it shows three dots "..."

 

<h2 class="matches"><span>Matches</span></h2>
<div class="cbox">
<div class="matches">
	<?
	$q = mysql_query("SELECT * FROM `matches` ORDER BY id DESC LIMIT 0,5");
	$matches = mysql_num_rows($q);
	if($matches > 0) {
	?>

	<table cellspacing="0" style="font-size: 10px;">
	<?
	$i = 0;
	while($r = mysql_fetch_array($q)) {
		$i += 1;
		$winner = split("-",$r['score']);
		if($winner[0] > $winner[1]) {
			$status = "<td class=\"win\">Win</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><font style="font-size:9px; color: #888888;">vs</font> <?=$r['team2']?></td>
			<td class="score"><?=$r['score']?></td>
			<?=$status?>
		</tr>
	<? }
	?></table><?
	} else {

		echo "<p>We haven't played any matches yet!</p>";
	}
	?>
	<p><a href="index.php?p=matches">View all matches</a></p>

</div>
</div>

Link to comment
https://forums.phpfreaks.com/topic/108436-solved-php-limit/
Share on other sites

Just to elaborate... using full tags isn't necessarily 'better.' Full tags are more compatible... as some server have short tags turned off.

 

If you want to make sure you script will work on ANY php build you execute it on, always use full tags (<?php #code# ?> )

 

If you only plan on executing the script on YOUR server, then short tags are fine and dandy and will save you a bit of time and disk space :)

Link to comment
https://forums.phpfreaks.com/topic/108436-solved-php-limit/#findComment-555926
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.