Why cant I make this code block work? Even though the connection was successful it still returns 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>";
}