I am trying to return results from my database so that I can create an XML file for use in Adobe Flex, where I will then populate a Google Map. At the moment using Charles i'm getting the following error mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource
Here is the code for my function:
public function getBusiness ($item)
{
$stmt = mysqli_prepare($this->connection,
"SELECT * FROM businesses");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$row = "";
echo "<?xml version=\"1.0\" ?><map>";
while(($row = mysql_fetch_assoc($stmt)) !== false)
{
echo "<business><businessid>" . $row["businessid"] . "</businessid>";
echo "<type>" . $row["type"] . "</type>";
echo "<name>" . $row["name"] . "</name>";
echo "<street>" . $row["street"] . "</street>";
echo "<city>" . $row["city"] . "</city>";
echo "<country>" . $row["country"] . "</country>";
echo "<postcode>" . $row["postcode"] . "</postcode>";
echo "<latitude>" . $row["latitude"] . "</latitude>";
echo "<longitude>" . $row["longitude"] . "</longitude>";
echo "<phonenumber>" . $row["phonenumber"] . "</phonenumber>";
echo "<email>" . $row["email"] . "</email>";
echo "<website>" . $row["website"] . "</website>";
echo "<logo>" . $row["logo"] . "</logo>";
echo "<description>" . $row["description"] . "</description>";
echo "<datesubmitted>" . $row["datesubmitted"] . "</datesubmitted></business>";
}
echo "</map>";
}
Can anybody help at all?