Reputation: 1
for example i already have an existing table name (Bronze) what i want is to create an another table called Bronze1,Bronze2,Bronze3,Bronze4, and so on . . in the table name
this is the sample of my code please help
for($i = 1; $i<99 ; $i++) {
$this_table = 'Bronze'.$i;
$create =mysql_query("Create Table $this_table")
}
Upvotes: 0
Views: 32
Reputation: 1423
Try this SQL-statement:
CREATE TABLE new_tbl LIKE orig_tbl;
in your case:
for($i = 1; $i<99 ; $i++) {
$this_table = 'Bronze'.$i;
$create =mysql_query("Create Table $this_table LIKE Bronze")
}
that will create a table based on another one.
Upvotes: 1