This is the code I wrote to output the data stored in my MySQL database, determined by the session variable username. I don't get any kind of error, but the echo doesn't display anything, which makes me assume that it's not reading the data properly. Is there anything that I've clearly done wrong here? Could it be a problem with the loop? Thanks in advance for your help.
session_start();
include("database.php");
include("login.php");
$query="SELECT * FROM user WHERE username=$_SESSION[username]";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$title=mysql_result($result,$i,"title");
$name=mysql_result($result,$i,"phone");
$extension=mysql_result($result,$i,"extension");
$email=mysql_result($result,$i,"email");
echo "$title";
$i++;
}