In PHP, how does one create a MySQL database by time? This post was last edited by UniverseOS from 2013-03-1711: 34: 14. I currently have a requirement to create a database by month (that is, date (Ym, my current SQL statements: $ SQL & nbsp; CREATE & nbsp; TABLE & nbsp; IF & nbsp; NOT & nbsp; how to CREATE a MySQL database by time in EXI PHP?
This post was last edited by UniverseOS at 11:34:14
I currently have a requirement to create a database by month (that is, date ('ym'). my current SQL statement:
$ SQL = "CREATE TABLE IF NOT EXISTS time (file_id int (10) auto_increment primary key, filename varchar (60), filepath varchar (60), filesize int (10 ), uploadtime date )";
If you assign time = date ('ym'), an error is reported (the SQL syntax is incorrect). how can this problem be solved?
------ Solution --------------------
$ Dbtime = date ('ym ');
$ SQL = "CREATE TABLE IF NOT EXISTS '$ dbtime '(....";
In fact, it's easy to add a character before you?
$ Dbtime = 't'. date ('ym ');
$ SQL = "CREATE TABLE IF NOT EXISTS $ dbtime (....";