mysql to populating a textarea with for loop

hi im setting up a football team website, and when a result is added, i have the add match page displaying
a text area, that automatically lists every player in the team from the database.
but i cant get it to display appropriately.
i want the text area to display every player found in the database by the following attributes and on a new line
without it displaying a new line character. then the admin guy can just delete the players from the list who
werent involved in that particular game.

----------------------
$no $name $pos

i.e.

1     yoshi   GK
2     mario  DEF
3     luigi     Mf
4     Toad   FWD

----------------------

code
--------

<textarea name="mSheet" cols="30" rows="16"><?
     $query = "SELECT * FROM players ORDER BY pNo";
     $result = mysql_query($query, $db);
     $players = mysql_num_rows($result);

      for ($i=0; $i < $players; $i++) {
            $pNo = mysql_result($result, $i, "pNo");                                  //player squad number
            $pName = mysql_result($result, $i, "pName");                            //player name
            $pPosition = mysql_result($result, $i, "pPosition");                                  //player position
            
                                $display =        $pNo.' '.$pName.' '.$pPosition;
            echo $display;
                  
                      echo "<br";  <-- this is wrong, it displays <br. im unsure of how to start a new line without it showing
      } ?>                
</textarea>

help much appreciated thanks
kostonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BogoJokerCommented:
The newline character is "\n"
It must be in double quotes for the new line to get sent.
\t is tab
\r is cariage return (can never spell that)

Joe P
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kostonAuthor Commented:
super mate, i tried \n but i hadnt put it in double quotes, works fine now points awarded :)
0
BogoJokerCommented:
Great, enjoy =)
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

BogoJokerCommented:
I also experimented with padding techniques.
So a good trick would be something like this:

$str = "";
$count = 1;
foreach ($teamPlayers as $individual)
  $str .= "$count. $individual[name]\t$individual[position]\n";

The only problem with this is that a person's name might be Pecoraro and another person's name might be Le.  The tabs would not exactly even up.  There is a php function called str_pad() and I played around with it so something like:

foreach ($teamPlayers as $individual)
  $str .= "$count. " . str_pad($individual[name], 10, ' ') . "\t$individual[position]\n";

That fixed most of my problems if not all.  Then the information in the textbox would line up nicely.  of course all the information I provided was completely made up, but I hope I passed the point on.

Joe P
0
kostonAuthor Commented:
hey cheerz mate i might have a go at implementing this especially when displaying it on the match report for example.
im in consideration on how automated to make the whole site. i was just going to make it so you add the goal scorers into a text box and thats it, ud have to add the goal tallys manually to each player profile.

or i was thinking that the team sheet textarea, you could just add say 1 at the end of that players row if that player scored 1 goal or 2 or whatever. then explode the row and get the goal value and auto increment the player profile goal tally.

this will add other problems tho like i have a update result page, so id have to store the players previous goal tally and increment/deincrement the tally by what ever the changed value was if it was changed. not sure how far im gonna go into this heh
0
BogoJokerCommented:
If you have a database it would be much easier then textfiles, so your on the right track. =)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.