0

我正在尝试从我的数据库中返回结果,以便我可以创建一个用于 Adob​​e Flex 的 XML 文件,然后我将在其中填充一个谷歌地图。目前使用查尔斯我收到以下错误mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource

这是我的功能的代码:

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>";


}

任何人都可以提供帮助吗?

4

2 回答 2

5

mysqli用于运行语句,然后尝试将结果处理为mysql?是的,那是行不通的。

使用来自同一扩展的功能!它们不是交叉兼容的。

于 2012-05-21T16:51:35.373 回答
0

您应该使用fetch_array () 而不是 mysql_fetch_assoc()

于 2012-05-21T17:32:44.653 回答