我想從我的數據庫返回結果,以便我可以創建一個XML文件以用於Adobe Flex,然後我將填充一個Google Map。在使用查爾斯的那一刻,我發現了以下錯誤mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource
PHP:麻煩使用mysql_fetch_assoc
這裏是我的功能代碼:
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>";
}
任何人可以幫助呢?
的可能重複[mysql_fetch_assoc():提供的參數不是在PHP中一個有效的MySQL結果資源(http://stackoverflow.com/questions/1858304/mysql-fetch-assoc-supplied-argument-is-not-a-valid-mysql-result-resource-in-p) –