PHP Align Center Code Issue

I can't get the display results to align in the center when displayed in a browser....what is wrong with my code?
<?php
$con = mysql_connect("localhost","uname","password");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("mydatabase", $con);

$result = mysql_query("SELECT * FROM mytable");

echo "<table border='6'>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Status</th>
<th></th>
</tr>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" align="center". $row['fname'] . "</td>";
  echo "<td>" align="center". $row['lname'] . "</td>";
  echo "<td>" align="center". $row['status'] . "</td>";
  echo "</tr>";
  }
echo "</table>";


?>

Open in new window

LVL 15
wantabe2Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mars-vieConnect With a Mentor Commented:
Of course you have to change all <td> tags to <td align='center'>

:-)
0
 
mars-vieCommented:
Change to
echo "<td align='center'>". $row['fname'] . "</td>";

Regards,
MARS-VIE
0
 
Lukasz ChmielewskiCommented:
... or use css for all the td's
td{text-align: center;}
0
All Courses

From novice to tech pro — start learning today.