exec($createTableQuery)) { echo "Database and table created successfully.
"; } else { echo "Error creating table: " . $db->lastErrorMsg() . "
"; } // Close the database connection $db->close(); } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "
"; } catch (Error $e) { echo 'Caught error: ', $e->getMessage(), "
"; } } else { echo "Database already exists.
"; } ?>