Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3337980
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:19:09+00:00 2026-05-18T00:19:09+00:00

This script works online but not offline via WAMP… function current_user() { static $current_user;

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T00:19:10+00:00Added an answer on May 18, 2026 at 12:19 am

    You have notices enabled on one server, but not the other. This notice is just telling you that are attempting to read an array element that doesn’t exist.

    Instead, try this

    if(isset($_SESSION['userID']))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This script works fine on single click but on double click it shows both
I just finished this script it works well, but I am struggling to pass
I have this script that works, but I need to change the format of
I have this jQuery script that works fine: $(select).change(function () { var finalPrice =
This script works great. I call it in top of my scripts. But if
This is the calendar script I got from an online tutorial. It works fine
What Works This sed script works as intended: $ echo -e 2\n1\n4\n3 | sed
I'm using this script which works fine for a single lightbox popup window. I
Can anyone tell me why this bash script works if I cut and paste
We have a ubuntu test server that this simple script works fine on where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.