The CREATE TABLE statement is using to create a table in MySQL.
The following example helps to create a table named “users”, with three columns: “FirstName”, “LastName” and “Age”:
< ?php $con=mysqli_connect("example.com","user01","password","my_db"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // Create table $sql="CREATE TABLE users(FirstName CHAR(30),LastName CHAR(30),Age INT)"; // Execute query if (mysqli_query($con,$sql)) { echo "Table users created successfully"; } else { echo "Error creating table: " . mysqli_error($con); }