我正在嘗試select hora from entradas where data ='some date';
。查詢MySQL php
表entradas
+------------+----------+ | data | hora | +------------+----------+ | 2012-09-27 | 07:59:11 | | 2012-09-27 | 16:03:27 | | 2012-09-28 | 16:03:35 | | 2012-09-29 | 09:29:16 | | 2012-09-29 | 09:43:05 | | 2012-09-29 | 09:43:14 | | 2012-10-01 | 08:03:10 | +------------+----------+
我能做到這一點在MySQL:
+----------+ | hora | +----------+ | 09:29:16 | | 09:43:05 | | 09:43:14 | +----------+
但是當我嘗試在PHP:
$consulta_data = mysql_query("
select hora from entradas where data = '2012-09-29';
") or die(mysql_error());
while($row = mysql_fetch_array($consulta_data))
{
echo $row[0];
}
的3行轉中一個給我結果09:29:1609:43:0509:43:14
。
我如何輸出的結果集,作爲HTML中的表,如下:
row[0]=09:29:16 row[1]=09:43:05 row[2]=09:43:14
你好,我嘗試它像你說的,讓這種致命的錯誤:無法使用[]在閱讀第80行的C:\ wamp \ www \ Controlo Entradas \ importar_BD.php – user1746620
80行是什麼?第80行中的 – nico
是這個echo $ response []; – user1746620