Hi
I have a login to a page and I want to display user details on that page - based on user id but can't get it working
The session is started and userid approved (using Dreamweavers restrict access script). Now I want to display some other details belonging to that user based on the user id they logged in with.
my code for this is:
<?php require_once('../Connections/own_local.php'); ?>
<?
$userid = $HTTP_SESSION_VARS["MM_Username"];
function rsgetuser($userid)
{
$db = mysql_select_db("members")
or die ("<p align=center><font face=verdana size=1>couldn't select db</font></p>");
$query = "SELECT company, email FROM memberlist WHERE username =" . $userid;
$result = mysql_query($query)
or die ("<p align=center><font face=verdana size=1>couldn't execute query</font></p>");
return mysql_fetch_array($result.MySQL_ASSOC);
}
$company = $rsgetuser["company"];
$email = $rsgetuser["email"];
echo $userid;
echo $company;
echo $email;
?>
... but the only thing that echoes is the userid!! So the username variable is echoing out but not the results of the SQL statement above. I can't see why not! The SQL statment returns the correct result when I enter it directly through phpmyadmin.
Anyone got any suggestions??