Jump to content

displaying data from database in table format


unknown87

Recommended Posts

$user_id=$_SESSION['user_id'];
$query = "SELECT first_name FROM players WHERE user_id = '$user_id'";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
     echo "Player: " . $row['first_name'] . "<br>";
}

 

I need the information i'm getting from the database to be put into table format.  Can someone tell me how I can achieve this.

 

Thanks in advance

$user_id=$_SESSION['user_id'];
$query = "SELECT first_name FROM players WHERE user_id = '$user_id'";
$result = mysql_query($query) or die(mysql_error());
echo "<table>";
while($row = mysql_fetch_array($result)) {
     echo "<tr><td>Player:</td><td> " . $row['first_name'] . "</td></tr>";
}
echo "</table>";

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.