Jump to content

Recommended Posts

Strict Standards: Creating default object from empty value

 

What does that error mean? The offending line is line 38.

Line 38 = $user->$key = $value;

 

The whole code for that area is-

            $query = $db->execute("select * from `users` where `id`=?", array($_SESSION['userid']));
            $userarray = $query->fetchrow();
            if ($query->recordcount() == 0)
            {
                session_unset();
                session_destroy();
                header("Location: index.php");
                exit;
            }
            foreach($userarray as $key=>$value)
            {
                $user->$key = $value;
            }
            return $user;

 

I also get a notice.

Notice: Undefined index: act in /home/katarra/public_html/fishing.php on line 60

 

Line 60 = if ($_GET['act'] == "fish")

 

The whole code for that bit is

if ($_GET['act'] == "fish") 
{
    
    if ($player->pole < 1) 
       {
        echo "You do not have a fishing pole!";
        exit;
    
    } 
else { // some other stuff which is irrelevant }

 

With the notice, it's recognising that the user has no poles, when infact.. you can even have a million and it'll still give the notice.

 

Can anyone help?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.