create a table in a database with php | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

create a table in a database with php

I'm moving my first steps with connecting php with databases. I want to create a table inside a database called "prova", inside a localhost made with xampp, but my code doesn't seem to work: $conn = mysqli_connect("localhost", "root", "", "prova"); $sql = "CREATE TABLE table_one( col1 varchar(255) );"; mysqli_query($conn, $sql);

23rd Apr 2020, 9:50 AM
Francesco Paolini
Francesco Paolini - avatar
1 Answer
+ 1
You could follow one of the online tutorials like this: https://www.tutorialrepublic.com/php-tutorial/php-mysql-create-table.php If you check the status of each step, like was the connection successful, was the table created, you can better figure out where is the issue. Help yourself analyse it with error messages that you write.
23rd Apr 2020, 11:14 AM
Tibor Santa
Tibor Santa - avatar