A few problems with this code. First of all, use
echo
. It is a lot faster than
print
. Second, the error in your SQL syntax is on this line.
$data = mysql_query('SELECT * FROM authentication WHERE id='.$_SESSION['username'])
I've taken the liberty of reqriting the code a bit. Here's the finished version
<?php
mysql_connect("interschoolsnetworkc.ipagemysql.com", "isn_1", "460980_jordy") or die(mysql_error());
mysql_select_db("isn_1") or die(mysql_error());
$user = @$_SESSION['username'];
$sql = mysql_query("SELECT * FROM `authentication` WHERE id='{$user}'")
or die(mysql_error());
echo "<table border cellpadding=\"3\">\n";
while($info = mysql_fetch_assoc($sql))
{
echo "<tr>\n".
"<th>First Name:</th><td>{$info['fname']}</td>\n".
"<th>Last Name:</th><td>{$info['lname']}</td>\n".
"<th>Username:</th><td>{$info['username']}</td>\n".
"<th>Year Group:</th><td>{$info['yeargroup']}</td>\n".
"<th>School:</th><td>{$info['school']}</td>\n".
"</tr>";
}
echo "</table>";
?>