I'm learning how to use mySQL database with PHP, is there a way to detect if the

table already exists? I want to made a Database that uses a new table in the database each day to collect information. I want to know if it's possible for the script to tell if the table hasn't been made yet for the day so it could create it then write data to it. or if it's there already just write data to it.
 
In your first query write:

CREATE TABLE IF NOT EXISTS `table1`...

Then write to that table in your second query. The second query will write to that table every time, but the first query will only create the table if it's not already there.
 
In your first query write:

CREATE TABLE IF NOT EXISTS `table1`...

Then write to that table in your second query. The second query will write to that table every time, but the first query will only create the table if it's not already there.
 
Back
Top