我想從另一個表的行此創建一個表名的新表是我做的,到目前爲止無法創建表與表的名稱空間動態
<?php
header('content-type:application/json; charset=utf-8');
include "db.php";
$sql=mysql_query("SELECT * from tb1");
while($row=mysql_fetch_assoc($sql))
$out[] = $row['title'];//see below what it outs
for($i=0;$i<=count($out);$i++)
{
$query = 'CREATE TABLE '.$out[$i].' (PersonID int,LastName varchar(255),FirstName varchar(255),Address varchar(255),City varchar(255))';
$sqls = mysql_query($query);
}
// if (!$sqls) {
//die('Invalid query: ' . mysql_error());
//}
?>
$出[]有一個像
輸出word one word two word three
Note:its not a single title it has three words
word one-->title one
word two -->title two
word three-->title three
[MySQL的 「架構對象名稱」](http://dev.mysql.com/doc/refman/5.6/en/identifiers.html)。養成閱讀文檔的習慣。 –
@ SverriM.Olsen我會跟着它 – Vinod