Hi, I have constructed this class for handeling making connections to a mysql database, but I can understand why this will not work, it allways returns the error:
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in C:\Inetpub\wwwroot\scriptsoft.co.uk\cpt\index.php on line 18
and this is the code:
<?php
class Connection {
var $result;
function Connection($localhost, $username, $password, $database){
$con = mysql_connect($localhost,$username,$password);
mysql_select_db($database, $con);
if($con)
{
$this->result = 'successful connection';
}
else
{
$this->result = 'failed connection';
}
}
$test = &new Connection('localhost','***username(removed)***','***password(removed)***','cpt'); //line 18
echo $test->result;
?>
Any help would be greatly apprieciated. Thanks,
Marcus