ramiro2016 Posted August 3, 2013 Share Posted August 3, 2013 Hi when i execute this script #class.ManageUsers.php <?php include_once('class.database.php'); class ManageUsers{ public $link; function __construct(){ $db_connection = new dbConnection(); $this->link = $db_connection->connect(); return $this->link; } function registerUsers($username,$email,$password,$ip_address,$time,$date){ $query = $this->link->prepare("INSERT INTO users (username,email,password,ip_address,time,date) VALUES (?,?,?,?,?,?)"); values = array($username,$email,$password,$ip_address,$time,$date); $query->execute($values); $counts = $query->rowCount(); return $counts; } } $users = new ManageUsers(); echo $users->registerUsers('bob','bob@gmail.com','bob','127.0.0.1','14:33','03-08-2013'); ?> #class.database.php <?php class dbConnection{ protected $db_conn; public $db_name = 'dz4d'; public $db_user = 'root'; public $db_pass = '198900'; public $db_host = 'localhost'; function connect(){ try{ $this->db_conn = new PDO("mysql:host=$this->db_host;dbname=$this->db_name",$this->db_user,$this->db_pass); return $this ->db_conn; } catch(PDOException $e) { return $e->getMessage(); } } } ?> I received this error message Parse error: syntax error, unexpected '=' in C:\VertrigoServ\www\dz4d\classes\class.ManageUsers.php on line 15 Quote Link to comment https://forums.phpfreaks.com/topic/280802-parse-error-in-manageusers-class/ Share on other sites More sharing options...
Solution kicken Posted August 3, 2013 Solution Share Posted August 3, 2013 values = array($username,$email,$password,$ip_address,$time,$date); You're missing the $ on your variable name. Quote Link to comment https://forums.phpfreaks.com/topic/280802-parse-error-in-manageusers-class/#findComment-1443352 Share on other sites More sharing options...
jazzman1 Posted August 3, 2013 Share Posted August 3, 2013 PHP is NOT C Quote Link to comment https://forums.phpfreaks.com/topic/280802-parse-error-in-manageusers-class/#findComment-1443353 Share on other sites More sharing options...
ramiro2016 Posted August 3, 2013 Author Share Posted August 3, 2013 ohhhhhhhhh SOLVED thx i'm just beginner Quote Link to comment https://forums.phpfreaks.com/topic/280802-parse-error-in-manageusers-class/#findComment-1443354 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.