小编use*_*544的帖子

PHP:使用mysql_fetch_assoc时遇到麻烦

我试图从我的数据库返回结果,以便我可以创建一个XML文件,以便在Adobe Flex中使用,然后我将填充Google Map.目前使用Charles我收到以下错误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>" …
Run Code Online (Sandbox Code Playgroud)

php mysql

0
推荐指数
1
解决办法
111
查看次数

标签 统计

mysql ×1

php ×1