我在使用这个脚本时遇到了问题,我将不胜感激:
<? php
//ini_set('display_errors', '1');
//MQSQL connection
require_once('../../include/init.phph');
function transportQueue(){
//siteinfoDbCon();
siteinfoDbConNoLag();
$query = "SELECT
a.transport_id, a.site_id, b.site_name, c.name as 'From DC',
d.name as 'To DC', a.cutover, a.working, a.error
FROM transport_queue a
INNER JOIN sites b ON(a.site_id=b.site_id)
INNER JOIN datacenters c ON(a.from_dc_id=c.datacenter_id)
INNER JOIN datacenters d ON(a.to_dc_id=d.datacenter_id)
WHERE
a.cutover BETWEEN NOW() AND ADDDATE(NOW(), INTERVAL 7 day)
ORDER BY a.cutover";
//Pull results
$results=mysql_query($query);
//Return into an array $transports
while($row=mysql_fetch_array($results,MYSQL_BOTH)){
$transports[]=$row;
print_r($transports[0]["site_id"]);
}
//Free up the results
mysql_free_result($results);
//Close the db connection
siteinfoDbClose();
}
transportQueue();
?>
我可以确认查询有效并且数据库连接有效……我不知所措。
我正在尝试将结果返回到关联数组中。我确实查看了以下问题/答案: Dump mysql_fetch_array results into a multidimensional array
尝试去
有什么想法吗?