这是MySQL查询:
SELECT `TABLE_SCHEMA` , `TABLE_NAME` , `COLUMN_NAME`
FROM `COLUMNS` WHERE `TABLE_SCHEMA` = 'zfk'
如何制作多维数组:
一级表模式(上面的查询只是一个演示,否则真正的查询没有
where
子句)。二级表名
三级列名
MySQL输出:
最佳答案
怎么样:
$query = mysql_query("SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME
FROM COLUMNS WHERE TABLE_SCHEMA = 'zfk'");
$resulting_array = array();
while($row = mysql_fetch_array($query, MYSQL_NUM)){
$resulting_array[] = $row;
}
print_r($resulting_array);
这将打印出:
[0] => array([0] => zfk, [1] => zfk_clients, [2] => id
[1] => array([0] => zfk, [1] => zfk_clients, [2] => company_name
[2] => array([0] => zfk, [1] => zfk_clients, [2] => web_address
等等。
关于php - 来自MySQL结果的多维数组,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/3799212/