$dbHeader = mysqli_connect("host", "username", "password", "db");
I use this to connect to database and it works. I'd tried this
$table = "users";
$query = "
CREATE TABLE IF NOT EXISTS $table(
id int(0) AUTO_INCREMENT,
userId bigint(0),
username varchar(200),
firstName varchar(200),
lastName varchar(200),
PRIMARY KEY (id)
)
";
$qu = mysqli_query($dbHeader, $query);
and it doesn't work so I'd tried with directly the name of the table and it works. i just tried with other queries and various methods like
$stmt = mysqli_prepare($dbHeader, "INSERT INTO users (userId, username, firstName, lastName) values (?,?,?,?)");
mysqli_stmt_bind_param($stmt, $userId, $username, $firstName, $lastName);
mysqli_stmt_execute($stmt);
but it still doesn't work.