crouchjay Posted May 13, 2006 Share Posted May 13, 2006 The following is the code. I keep getting aParse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/crouchja/public_html/mysql.class.php on line 5.<?phpclass mysql {**I am assuming this is line 5--> private $linkID; //MySQL link identifier private $host; //MySQL server host private $user; //MySQL user private $pswd; //MySQL password private $db; //MySQL database private $result; //Query result private $querycount; //Total queries executed /* Class constuctor. Initializes the $host, $user, $pswd and $db fields. */ function mysql($host, $user, $pswd, $db) { $this->host = $host; $this->user = $user; $this->pswd= $pswd; $this->db = $db; }//End of mysql constuctor /*Connects to the MySQL database server. */ function connect() { try { $this->linkID = @mysql_connect($this->host,$this->user,$this->pswd); if (! $this->linkID) throw new Exception ("Could not connect to the database server1."); }//End of try catch (Exception $e) { die ($e->getMessage()); }//End of catch } /* Selects the MySQL database. */ function select() { try { if (! @mysql_select_db($this->db, $this->linkID)) throw new Exception("Could not connect to the database server2."); }//end of try catch (Exception $e) { die ($e->getMessage()); }//end of catch }} Quote Link to comment Share on other sites More sharing options...
_will Posted May 14, 2006 Share Posted May 14, 2006 Are you running PHP5? That code will not work in PHP4 because classes in PHP4 don't recognize private vs. public. Quote Link to comment Share on other sites More sharing options...
crouchjay Posted May 16, 2006 Author Share Posted May 16, 2006 Thank you. Cleared up the problem. Quote Link to comment 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.