Query ("$sql");//}//Create a new ID storage table, in fact, there is no need to call ID, if the business volume of large by month day also line, by increment also line. CREATE TABLE ' Test '. ' create_id ' (' ID ' BIGINT () not NULL auto_increment PRIMARY KEY) ENGINE = myisam;//Create a new general table, there is no need Own experience (later use to paging, statistics when the direct call on the line, the speed of the query is very fast, if you do not want this table, it is used when the union query: put all the table name into the array, and then foreach in the Assembly of SQL. Union. So it's better to start with a good time.//CREATE TABLE ' article_total ' (//' ID ' bigint () not null,//' subject ' varchar ($) Not null,//' Co Ntent ' text not null,//PRIMARY KEY (' id ')//) Engine=mrg_myisam DEFAULT Charset=utf8 union= (' article_0 ', ' article_1 ', ' AR Ticle_2 ', ' article_3 ');//Query OK, 0 rows affectedfunction get_ai_id () {global $mysqli; $mysqli->query (' INSERT INTO CREATE_ID (ID) VALUES ("") ');Returns the insertion ID value of return mysqli_insert_id ($MYSQLI);} function new_article () {global $mysqli; echo $id =get_ai_id (); Echo $table _name=get_table_name ($id); $sql = "INSERT INTO {$ TABLE_NAME} (Id,subject,content) VALUES (' {$id} ', ' title ', ' content '), "Echo $sql; $mysqli->query ($sql);} function Get_table_name ($id) {return ' Article_ '. Intval ($id)%10;} New_article ();
The above describes the PHP operation MySQL database simple sub-table principle-with detailed steps, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.