This question already has an answer here:
I can't seem to find why I'm getting a
Parse error: syntax error, unexpected 'if' (T_IF) in /Applications/XAMPP/xamppfiles/htdocs/oop/index.php on line 8
I checked for missing semi-colons/parentheses/curly braces but can't find anything! There are a few more other files these are referring to. Should I post them as well?
(getInstance
is a static method in my db
class)
(count
and get
are methods in my db
class)
Thanks in advance!
<?php
require_once 'core/init.php';
$user = DB::getInstance()->get('users', array('username', '=', 'bob'));
if(!$user->count()) {
echo 'No user';
} else {
echo 'OK';
}
?>
init.php looks like this:
<?php
session_start();
$GLOBALS['config'] = array(
'mysql' => array(
'host' => '127.0.0.1',
'username' => 'root',
'password' => '',
'db' => 'oop'),
'remember' => array(
'cookie_name' => 'hash',
'cookie_expiry' => 604800),
'session' => array(
'session_name' => 'user')
);
spl_autoload_register(function($class) {
require_once 'classes/' . $class . '.php';
});
require_once 'functions/sanitize.php';
?>
</div>