dezkit Posted June 1, 2008 Share Posted June 1, 2008 if there is a space in $name, so there is $nickname $name = "justin beos"; $nickname = "powda"; <a href="index.php?p=profile&pid=<?=$r['id']?>"> <?=$r['name']?> <?=$r['nickname']?> </a> output has to be Justin "Powda" Beos not Justin Beos Powda Link to comment https://forums.phpfreaks.com/topic/108260-solved-is-this-possible/ Share on other sites More sharing options...
Daniel0 Posted June 1, 2008 Share Posted June 1, 2008 How would you ever get Justin Beos Powda to become george "killa" bush? ??? Link to comment https://forums.phpfreaks.com/topic/108260-solved-is-this-possible/#findComment-554980 Share on other sites More sharing options...
dezkit Posted June 1, 2008 Author Share Posted June 1, 2008 LOL, my bad! haha Link to comment https://forums.phpfreaks.com/topic/108260-solved-is-this-possible/#findComment-554981 Share on other sites More sharing options...
Daniel0 Posted June 1, 2008 Share Posted June 1, 2008 Ok. Another time, please don't modify the post after people have responded. You can do this (not tested): $names = array_map('ucwords', explode(' ', $r['name'])); $name = "{$names[0]} \"" . ucwords($r['nickname']) . "\" {$names[1]}"; Link to comment https://forums.phpfreaks.com/topic/108260-solved-is-this-possible/#findComment-554984 Share on other sites More sharing options...
dezkit Posted June 1, 2008 Author Share Posted June 1, 2008 thanks for the responce, and ill never edit ever again!! but, can you further elaborate what you wrote? please! and no, it doesnt work... ;/ Link to comment https://forums.phpfreaks.com/topic/108260-solved-is-this-possible/#findComment-554987 Share on other sites More sharing options...
dezkit Posted June 1, 2008 Author Share Posted June 1, 2008 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> Link to comment https://forums.phpfreaks.com/topic/108260-solved-is-this-possible/#findComment-554989 Share on other sites More sharing options...
Daniel0 Posted June 1, 2008 Share Posted June 1, 2008 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? Link to comment https://forums.phpfreaks.com/topic/108260-solved-is-this-possible/#findComment-554991 Share on other sites More sharing options...
dezkit Posted June 1, 2008 Author Share Posted June 1, 2008 im so sorry man, but can you put that in my code, i have no clue where to put it in, im sooo sorry and thanks sooo much!! Link to comment https://forums.phpfreaks.com/topic/108260-solved-is-this-possible/#findComment-554993 Share on other sites More sharing options...
Daniel0 Posted June 1, 2008 Share Posted June 1, 2008 <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> Link to comment https://forums.phpfreaks.com/topic/108260-solved-is-this-possible/#findComment-554995 Share on other sites More sharing options...
dezkit Posted June 1, 2008 Author Share Posted June 1, 2008 works!! thanks a bunch! Link to comment https://forums.phpfreaks.com/topic/108260-solved-is-this-possible/#findComment-554996 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.