hey guys...
ok i have a database with ppls address fonenum faxnum email login and password
now when that user is logged in
it starts a session and assigns a variable for the users name
$_SESSION['user']
i know this variable contains the right information because when i use the echo statement it displays the user's name
however... when i want to display a specific row from my database on the page --with the following code
$result = mysql_query("SELECT * FROM register WHERE login ='$_SESSION['user']'");
echo $result;
--- the page displays "Resource id #2"
can anyone help?
Resource id #2 ???
Moderator: General Moderators
You are missing one of the mysql_fetch_ functions after the query.
See http://php.net/mysql_query and http://php.net/mysql_fetch_assoc for examples.
See http://php.net/mysql_query and http://php.net/mysql_fetch_assoc for examples.
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
lol, we've all wondered this at some point.
basically you need to create an array for it,
continuing on your code
good luck
basically you need to create an array for it,
continuing on your code
Code: Select all
$result = mysql_query("SELECT * FROM register WHERE login ='$_SESSION['user']'");
$array = mysql_fetch_array($result, MYSQL_ASSOC);
// now to print use $array['username'], $array['password'] etc etc
// you will need to make a loop to get all values