Jump to content

Class Problem


iMiles

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/206966-class-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.