I'm creating a page to view one's profile (all informations about him that are stored in the DB - except some which I didn't select).
I have this code:
<?php
if($_SESSION['id']) {
echo '<h2>Hello, '.$_SESSION['usr'].'!<br>You are registered and logged in!</h2>';
$result = mysql_query("SELECT id,usr,pass,email,dt,priv FROM tz_members WHERE usr = $)SESSION['usr']");
echo "<table border='0'>
<tr>
<th style='width: 15px'>ID</th>
<th style='width: 300px'>Username</th>
<th style='width: 100px'>Privileges</th>
<th style='width: 200px'>Join Date</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['usr'] . "</td>";
echo "<td>" . $row['priv'] . "</td>";
echo "<td>" . $row['dt'] . "</td>";
echo "</tr>";
}
echo "</table>"; }
else echo '<div class="roundbox"><h2>Please, <a href="login.html">login</a> and come back later!</h2></div>';
?>
It seems to generate an error:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/u594115708/public_html/viewprofile.html on line 66
To be more precise, the 'line 66' it talks about is this one:
while($row = mysql_fetch_array($result))
Could you tell me what am I doing wrong ?