I am trying to create a mysql table, and i have tried the following code: ( please excuse some of the varchar(255)'s )
$connection = @mysqli_connect($host, $user, $pswd);
if($connection->connect_error){
die("Connection failed: " . $connection->connect-error);
}else{
echo "Connected <br>";
}
$createTable = "CREATE TABLE IF NOT EXISTS cabBookings (
_booking_code VARCHAR(10) NOT NULL PRIMARY KEY,
_customer_name VARCHAR(100) NOT NULL,
_customer_phone VARCHAR(255) NOT NULL,
_customer_address_unit VARCHAR(255) NOT NULL,
_customer_address_num VARCHAR(255) NOT NULL,
_customer_address_name VARCHAR(255) NOT NULL,
_customer_suburb VARCHAR(255) NOT NULL,
_destination_suburb VARCHAR(255) NOT NULL,
_pickup_date VARCHAR(255) NOT NULL,
_pickup_time VARCHAR(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8";
$queryResult = @mysqli_query($connection, $tester)
or die ("error". mysqli_error($connection));
@mysqli_select_db($connection, $dbnm)
or die('Database not Available');
But this is not working. It prints out "error" but doesn't actually create the table, nor print out the error it is receiving. I have input my code into various checkers- all to no avail, and have run out of ideas.
NOTE: The connection to the database IS working.
NOTE2: this code is in a php file.
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire