我正在使用XAMPP服务器。使用phpMyAdmin,我创建了一个数据库和一个名为“Users”的表。当我运行下面的代码时,它会显示Error in your query
。我的代码怎么了?
function selectMultiRows($query)
{
if((@$result = mysql_query ($query))==FALSE)
{
echo "<strong>Error in your query:</strong> <br>$query";
}
else
{
$count = 0;
$data = array();
while ( $row = mysql_fetch_array($result))
{
$data[$count] = $row;
$count++;
}
return $data;
}
}
$query = "select * from Users";
$returnedData = selectMultiRows($query);
$totalRecords = count($returnedData);
for($i=0;$i<$totalRecords;$i++)
{
echo $returnedData[$i]["username"] . "<br>";
}