Hey guys,
I am really close with this but can't quite get it right... All I am trying to do is retrieve the users details based on their 'u_id' and display them.
<?php
require ('dbconnect.php');
$user = $_SESSION['username']; //Get the users username
$requestuid = mysql_query("SELECT u_id FROM user_usr WHERE u_username = '$user'"); //Get the users u_id based on their username
$resultuid = mysql_fetch_assoc($requestuid);
echo $resultuid['u_id']; //THIS PRINTS THE USERS ID NO
?>
<table>
<tr>
<td>Gender:</td>
<td>
<?php
$request = mysql_query("SELECT u_gender FROM users WHERE u_id = '$resultuid'");
$result = mysql_fetch_assoc($request);
echo $result['u_gender']; //THIS DOESN'T PRINT THE USERS GENDER
?>
</td>
</tr>
</table>
In my head this should work, but I can't quite get it. Can anyone see where I'm going wrong?
Many Thanks,
Nonshatter