iMiles Posted July 7, 2010 Share Posted July 7, 2010 Hey there, lookie here: <?php class user { // Initialize the variables var $id; var $firstname; function __construct() { // Now add the session variables $this -> id = $_SESSION['id']; $connect = mysql_connect("localhost", "root", "root"); $query = mysql_query("SELECT * FROM users where id = '$this -> id'"); } } ?> I get this error: Catchable fatal error: Object of class user could not be converted to string in /Users/home/Desktop/Miles/HS/classes.php on line 18 Ideas? Quote Link to comment https://forums.phpfreaks.com/topic/206966-class-problem/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 7, 2010 Share Posted July 7, 2010 $this -> id Should be - $this->id no spaces around the -> Quote Link to comment https://forums.phpfreaks.com/topic/206966-class-problem/#findComment-1082272 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.