This script works online but not offline via WAMP...
function current_user()
{
static $current_user;
if(!$current_user)
{
if($_SESSION['userID'])
{
$userID = intval($_SESSION['userID']);
$query = "SELECT *
FROM `users`
WHERE `id` = $userID";
$data = mysql_query($query);
if(mysql_num_rows($data))
{
$current_user = mysql_fetch_assoc($data);
return $current_user;
}
}
}
return $current_user;
}
When this function is called, I get the following error message...
Notice: Undefined index: userID in C:\wamp\www\alpha\_includes\session.php on line 38
Line 38 is $userID = intval($_SESSION['userID']);
The error only occurs when the userID
SESSION variable isn't set. That and when the function is called via a page from my offline testing computer (running WAMP).
As a side note, this isn't my script. Credit goes to Jim Hoskins of Think Vitamin Membership.