TeddyKiller Posted March 12, 2010 Share Posted March 12, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/195039-strict-standards-creating-default-object-from-empty-value/ Share on other sites More sharing options...
KevinM1 Posted March 12, 2010 Share Posted March 12, 2010 1. Are you declaring your user and player objects anywhere? 2. Can you show us your class code? Quote Link to comment https://forums.phpfreaks.com/topic/195039-strict-standards-creating-default-object-from-empty-value/#findComment-1025280 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.