I can create a table in phpMyAdmin but not within oop mysqli script. Can someone pls straighten me out?
[php] include_once ($_SERVER[‘DOCUMENT_ROOT’] . ‘/cgi-bin/cnnct2mysqli.php’);
$mysqli = new mysqli($DBServer, $DBUser, $DBPass, $DBName);
if ($mysqli->connect_errno) {
echo “Failed to connect to MySQL: (” . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
$id = '';
$hits = 223;
If(!$mysqli->query("CREATE TABLE tstTB (
id
int(6) unsigned NOT NULL auto_increment,//i
hits
int(6) unsigned NOT NULL default ‘0’, //d
PRIMARY KEY (id
),
")) echo “$mysqli not an object.”;
$stmnt = $mysqli->prepare(“INSERT INTO tstTB(id
, hits
) VALUES (?, ?)”)
$stmnt->bind_param(‘id’, $id, $hits); //This Line: “syntax error, unexpected T_VARIABLE”
if (!$stmnt->execute()) {echo “Execute failed: (” . $stmt->errno . ") " . $stmnt->error;}
$stmt->close();[/php]
Help appreciated.
usit