我正在努力解决这个MySQL错误,我正在使用PHP脚本。
<?php
$connection = mysql_connect('localhost','XXX','XXXX');
mysql_select_db('mybd');
echo "<table>";
echo "<table border = 1>";
echo "</td><td>". "Circuito Estoril" . "</td></tr>";
$query = "SELECT * from tempos GROUP BY piloto";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
echo "</td><td>" . $row['piloto'];
foreach($row as $value)
{
$query = "SELECT * from tempos WHERE piloto = " . $value . "ORDER BY tempo";
$resultado = mysql_query($query);
while($rows = mysql_fetch_array($resultado))
{
echo "</td><td>" . $rows['tempo'] . "</td><td>" . $rows['data'] . "</td></tr>";
}
}
}
echo "</table>";
mysql_close();
?>
我得到的错误是警告:mysql_fetch_array()期望参数1是资源,第21行的******中给出的布尔值
有人可以指点我吗?
谢谢我提前
答案 0 :(得分:0)
将您的查询更改为:
"SELECT * from `tempos` GROUP BY `piloto`";
和这一个:
$query = "SELECT * from `tempos` WHERE `piloto` = '".$value."' ORDER BY `tempo`";
在ORDER BY之前放置空格