adam84 Posted March 12, 2007 Share Posted March 12, 2007 I got this stupid error message: Call to a member function on a non-object. any ideas? <? include("include/info.php"); $link = ~~~~~~~~~~ mysql_select_db (~~~); $email = $_GET['email']; $name= $_GET['name']; $query = "SELECT * FROM users WHERE userEmailPrim = '$email' AND userName= '$name'"; $r = mysql_query( $query, $link ); if( mysql_num_rows( $r ) > 0){ $row = mysql_fetch_row( $r ); $info->userInformation( $row[0] ); <---- error occurs here } else echo "user not found"; ?> <? class info{ var $userid; function info(){ $this->$userid = -1; } function userInformation($userID){ $this->userid = $userID; } } ?> Link to comment https://forums.phpfreaks.com/topic/42313-call-to-a-member-function-on-a-non-object/ Share on other sites More sharing options...
vbnullchar Posted March 12, 2007 Share Posted March 12, 2007 you didnt initialize the class $info=new info(); Link to comment https://forums.phpfreaks.com/topic/42313-call-to-a-member-function-on-a-non-object/#findComment-205258 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.