Jump to content

Parse error in ManageUsers class


Go to solution Solved by kicken,

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','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
Link to comment
https://forums.phpfreaks.com/topic/280802-parse-error-in-manageusers-class/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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