while错误:警告:mysqli_stmt :: fetch():无法在其中获取mysqli_stmt

时间:2019-11-19 03:49:51

标签: php

我收到此错误:

  

警告:mysqli_stmt :: fetch():无法获取mysqli_stmt

我不知道如何解决它。也许是因为一段时间,我在另一个循环中有一个查询。

<?php
                            $sql = "select id,accion,tipo from acciones order by id";
                            $stmt = $conexion->prepare($sql);
                            $stmt->execute();
                            $stmt->bind_result($id,$accion,$tipo);
                            while ($stmt->fetch()){
                            echo "<tr>";
                            echo "<td>$accion</td>";
                            if(strlen(trim($tipo)==0) echo"<td>No está</td>";
                            else {
                                $sql2 = "select tipo from accionestipo where id = $tipo";
                                $stmt2 = $conexion->prepare($sql2);
                                echo $sql2;
                                $stmt2->execute();
                                $stmt2->bind_result($accionestipo);
                                $stmt2->fetch();
                                $stmt2->close();
                                echo "<td>$accionestipo</td>";

                            }
                         }
?>
<table>
                            <tr>
                                <th>No.</th>
                                <th>Accion</th>
                                <th>Tipo</th>
                            </tr>
 </table>

0 个答案:

没有答案