Jump to content

[SOLVED] is this possible


dezkit

Recommended Posts

this is my whole code

 


<h2 class="main"><span>Roster</span></h2>
<div class="cbox roster">
<div style="text-align: center;">
<?
$q = mysql_query("SELECT * FROM `roster` ORDER BY `team` DESC");
$members = mysql_num_rows($q);

if($members) {
	?>
	<table cellspacing="0" class="full">
	<?
	$i = 0;
	$team = "";
	while($r = mysql_fetch_array($q)) {
		$i += 1;
			if(file_exists("images/roster/".$r['id'].$r['filetype'])) {
				$pic = "images/roster/".$r['id'].$r['filetype'];
			} else {
				$pic = "images/roster/blankpic.jpg";
			}
		if($team != $r['team']) {
		$team = $r['team'];
		?>
		<tr>
			<td colspan="3" class="teamdivider"><?=$team?></td>
		</tr>
		<? } ?>
		<tr class="row<?=($i&1)?>">
			<td><img src="<?=$pic?>" width="50" alt="" /></td>
			<td style="text-align: left;">








<a href="index.php?p=profile&pid=<?=$r['id']?>">
<?=$r['name']?> "<?=$r['nickname']?>"
</a>






</td>


		</tr>
	<?
	}
	echo "</table>";
} else {
	echo "<p>We have no players on the roster yet!</p>";
}
?>
</div>
</div>

I just tried...

 

<?php
$r['name'] = "justin beos";
$r['nickname'] = "powda";

$names = array_map('ucwords', explode(' ', $r['name']));
$name = "{$names[0]} \"" . ucwords($r['nickname']) . "\" {$names[1]}";

echo $name;
?>

 

outputs:

 

Justin "Powda" Beos

 

Is that not what you wanted? In what way doesn't it work?

<h2 class="main"><span>Roster</span></h2>
<div class="cbox roster">
<div style="text-align: center;">
<?
$q = mysql_query("SELECT * FROM `roster` ORDER BY `team` DESC");
$members = mysql_num_rows($q);

if($members) {
	?>
	<table cellspacing="0" class="full">
	<?
	$i = 0;
	$team = "";
	while($r = mysql_fetch_array($q)) {
		$names = array_map('ucwords', explode(' ', $r['name']));
		$name = "{$names[0]} \"" . ucwords($r['nickname']) . "\" {$names[1]}";
		$i += 1;
			if(file_exists("images/roster/".$r['id'].$r['filetype'])) {
				$pic = "images/roster/".$r['id'].$r['filetype'];
			} else {
				$pic = "images/roster/blankpic.jpg";
			}
		if($team != $r['team']) {
		$team = $r['team'];
		?>
		<tr>
			<td colspan="3" class="teamdivider"><?=$team?></td>
		</tr>
		<? } ?>
		<tr class="row<?=($i&1)?>">
			<td><img src="<?=$pic?>" width="50" alt="" /></td>
			<td style="text-align: left;">








<a href="index.php?p=profile&pid=<?=$r['id']?>">
<?= $name ?>
</a>






</td>


		</tr>
	<?
	}
	echo "</table>";
} else {
	echo "<p>We have no players on the roster yet!</p>";
}
?>
</div>
</div>

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.