I'm going crazy trying to write my first php class; it is supposed to connect me to server and to a database but I'm always getting this error:
Parse error: syntax error, unexpected ',', expecting T_PAAMAYIM_NEKUDOTAYIM in /Applications/XAMPP/xamppfiles/htdocs/classTest/test.php on line 9
Şimdiden teşekkürler, burada kodu:
<?php
// include 'DBConnect.php';
class DBConnect
{
function connection($hostname = "localhost", $myname = "root", $pass = ''){
mysql_connect(&hostname, &myname, &pass) or die("Could not connect!"); //Connect to mysql
}
function choose($dbnam){
mysql_select_db(&dbnam) or die("Couldn't find database!"); //fnd specific db
}
}
$a = new DBConnect();
$connect = $a->connection("localhost", "root");
$a->choose('mydb');
?>