I am playing around with making a simple mysql api.
[B]The API Class
[CODE]
CLASS testClass {
FUNCTION connectLocal($user, $pass) {
$local = my_sql(‘localhost’, $user, $pass)
IF (!$local) { DIE(‘connection error’); }
}
FUNCTION query($sql) {
RETURN mysql_query($string);
}
}
[B]Test.php
[CODE]
$db = new testClass;
$db->connectLocal(‘user’, ‘pass’)
$db->query(‘SELECT * FROM table1’);
The error I get is:[INDENT]
Parse error: syntax error, unexpected T_VARIABLE in test.php
[/INDENT]
If I put the querry inside the classes connectLocal function it works fine. Anywhere else it throws this error.
Any ideas? Thanks in advance.