Mysqli问题在第一次执行代码时发生

时间:2013-06-20 20:46:02

标签: php mysqli

我收到了这个警告:

  

警告:mysqli :: query():无法获取mysqli   /home/gourmetapp/public/apiapper.com/public/potentia/classes/Packs.class.php   在第225行

     

警告:mysqli :: close():无法获取mysqli   /home/gourmetapp/public/apiapper.com/public/potentia/classes/Packs.class.php   在第253行

有趣的是,我第一次执行此代码时就得到了它。当我重新加载页面时,它按预期工作。

我的代码在这里:

$query="SELECT * FROM packs where id_login='".$id."' order by id DESC";

    if ($result = $this->mysqli->query($query)) {

/* fetch associative array */
            echo "<div class='span7'><table name='reservas' class='table table-striped table-condensed'><thead><tr>";
        echo "<th>id</th><th>Nombre</th><th>Zip Subido</th><th>Directorio en Ipad</th><th>Fecha Creación</th></tr>";
        echo "<tbody>";

            while ($row = $result->fetch_assoc()) {
            $this->iddueno=$row['id'];
            $this->nombrePack=$row['nombre'];
            $this->contenido=$row['contenido'];
            $this->fechaPack=$row['fecha'];
            $this->directorioPack=$row['directorio'];

            echo "<tr><td>".$this->iddueno."</td><td>".$this->nombrePack."</td><td>".$this->contenido."</td><td>".$this->directorioPack."</td><td>".$this->fechaPack."</td></tr>";


            }

        echo "</tbody>";
        echo "</table></div>";


        $result->free();

    }

0 个答案:

没有答案