i have been looking everywhere for an answer to this and i still havent found one that works
what i want to be able to do is display the details of the user that is logged in but instead it shows the whole database
here is my code:
<?php
require('authenticate.php');
?>
<!-- Start get page name -->
<?
$currentFile = $_SERVER["PHP_SELF"];
$parts = Explode('/', $currentFile);
?>
<!-- End get page name -->
<!DOCTYPE HTML>
<html>
<head>
<title>My Account</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
@import url("style.css");
</style>
</head>
<body class="about">
<!-- Start NavBar -->
<?php
require('topnavbar.php');
?>
<!-- End NavBar -->
<div id="page-container">
<div id="header">
</div>
<div id="sidebar-a"></div>
<div id="content">
<div class="padding">
<div id="user-details">
<?php
// Connects to your Database
mysql_connect("interschoolsnetworkc.ipagemysql.com", "isn_1", "460980_jordy") or die(mysql_error());
mysql_select_db("isn_1") or die(mysql_error());
$data = mysql_query('SELECT * FROM authentication WHERE id='.$_SESSION['username'])
or die(mysql_error());
Print "<table border cellpadding=3>";
while($info = mysql_fetch_array( $data ))
{
Print "<tr>";
Print "<th>First Name:</th> <td>".$info['fname'] . "</td> ";
Print "<th>Last Name:</th> <td>".$info['lname'] . "</td> ";
Print "<th>Username:</th> <td>".$info['username'] . " </td>";
Print "<th>Year Group:</th> <td>".$info['yeargroup'] . "</td> ";
Print "<th>School:</th> <td>".$info['school'] . " </td></tr>";
}
Print "</table>";
?>
</div>
<p> </p>
<p> </p>
</div>
</div>
<div id="footer">
<div id="altnav">
<a href="index.php">Home</a> -
<a href="login.php">Login</a> -
<a href="register.php">Register</a> -
<a href="about.php">About</a> -
<a href="terms.php">Terms & Conditions</a>
</div>
<div id="copyright">© 2011 InterSchoolsNetwork, All Rights Reserved - A <a href="http://jordansmithsolutions.co.uk">Jordan Smith Solutions</a> & <a href="http://www.joecocorp.webs.com/">JoeCo Corp Production</a><br />
</div>
</div>
</div>
</body>
</html>
unfortunately with this code i get an error this is
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1