I have now tried to make to different classes using PHP. One for MySQL and one for FTP. I tried to use an example I got from a book for the MySQL. I get this error when I try to invoke both of the classes:
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /udrive/student/tmullin/public_html/WorkStudy/mysql.class.php on line 4
Does anyone know how I can resolve this problem?
Here is the source for my class:
<?php
//MySQL class to call from
class mysql{
private $linkID; //MySQL link ID
private $host; //MySQL server host
private $username; //MySQL user ID
private $password; //MySQL password
private $DB; //MySQL database
private $result; //MySQL query result
private $querycount; //Total amount of queries
//Class constructor. Initializes data for host, user, password, and database fields
function_construct( $host, $username, $password, $DB ){
$this->host = $host;
$this->username = $username;
$this->password = $password;
$this->DB = $DB;
}
//Function to connect to the MySQL database server
function connect()
{
try{
$this->linkID = @mhysql_connect( "$this->host, $this->username, $this->password" );
if( ! $this->linkID )
throw new Exception( "Could not connect to the MySQL server." );
}
//Catch exception if the connection to the MySQL database wasn't made and output it
catch(Exception $e)
{ die( $e->getMessage() );
}
}