Jump to content

Parse error in ManageUsers class


ramiro2016

Recommended Posts

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','[email protected]','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
Link to comment
https://forums.phpfreaks.com/topic/280802-parse-error-in-manageusers-class/
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.