I'm creating a db and table creation script. The db is being created, but the tables are not. When I copy my CREATE TABLE sql directly into phpMyAdmin, it inserts successfully. So I'm not sure what the issue is.
function createdb() {
include 'DbConnect.php';
$qry = "CREATE DATABASE chinesegame2";
$sql = $mysqli->query($qry);
$stats = "CREATE TABLE stats (
id_stats INT(10) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id_stats),
id_user_fk VARCHAR(30),
level VARCHAR(255),
experience INT(10),
item_a INT(10),
item_b INT(10),
item_c INT(10)
)";
if ($mysqli->query($stats)) {echo "Table stats created successfully";}
else { printf("Connect failed: %s\n", $mysqli->connect_error);}
mysqli_close($mysqli);
}
Result: chinesegame2 database is created, but no tables are created. $mysqli->connect_error only gives "Connect failed:".
Any thoughts why?
Thanks