0

I've been searching and searching, but my little brain simply can't come to a solution with any of the guides in here.

I have this PHP code:

"echo("<center><p>");
while($row = mysqli_fetch_array($result))
  {
  echo $row['ID'] . " " . $row['Navn'] . " " . $row['Score'];
  echo "<br/>";
  }
echo("</p></center>");"

"Navn", "Score" and "ID" is put in a database, which this code is getting out looks like this:
24 hans 9895
23 simon 9895
22 Simon Hansen 9860

On the left (24, 23 etc) you see "ID", "Navn" in the middle and "Score" on the right - very pretty. What I now want to do, is to make a cell for each of those 3 and give them a certain width, so that it is less messy and more structured to look at. I hope someone understands what I mean, and that someone is willing to help :)

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

2

You need to use tables and then style them. Here's an example of how to use html tables (http://www.w3schools.com/tags/tag_table.asp):

echo("<table>");
while($row = mysqli_fetch_array($result))
{
    echo "<tr><td width=50>" . $row['ID'] . "</td><td width=100>" . $row['Navn'] . "</td><td width=50" . $row['Score'] . "</td></tr>";
}
echo("</table>");

I haven't tested the code but you get the idea.

Stan
  • 1,251
  • 1
  • 15
  • 24