cerberus478 Posted April 17, 2014 Share Posted April 17, 2014 Hi I'm getting this error Notice: Trying to get property of non-object in line 17 on that line is $this->name = $result->name; this is the entire line function setFromDatabase(){ global $_FRAMES_TABLE; $query = mysql_query("SELECT * FROM $_FRAMES_TABLE WHERE id='$this->id'"); $result = mysql_fetch_object($query); $this->name = $result->name; $this->content = $result->content; $this->image = $result->image; } I'm not sure why I'm getting this error or how I can go about fixing it Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted April 17, 2014 Share Posted April 17, 2014 your query didn't match any rows and $result is a false value instead of an object from the mysql_fetch_object() statement. the WHERE clause in the query is false, either because there's no row where id = '$this->id' or $this->id may be empty. where did you get this code? it doesn't have any error checking logic (the errors in some of your previous threads), nor is it testing if the query matched any rows before trying to use the data from the query (the error in this thread)? Quote Link to comment 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.