Heres my code to connect to the database
function createConnection($DB_USER, $DB_PASSWORD){
$dbc = new PDO('mysql:host=****', $DB_USER, $DB_PASSWORD);
}
and below and is the code for a function being called
function checkIfUserExists($dbc, $username, $table){
global $dbc;
$stmt = $dbc->prepare("SELECT * FROM ? WHERE username = ?");
$stmt = bindParam(1, $table);
$stmt = bindParam(2, $username);
$stmt->execute();
}
below is the code i use to call them
$connect = new databaseOperations;
$connect->createConnection($DB_USER, $DB_PASSWORD);
$connect->checkIfUserExists($dbc, login, Username);
my question is why am i getting the call to a member function prepare() on a non-object error when the page loads?