致命错误:在第14行的/home/u545753064/public_html/index.php中调用未定义的函数mysqli_fetch_rows()

时间:2016-06-02 03:58:14

标签: php mysqli

  

我在学校的项目中需要这个代码,请帮我解决这个问题   代码,我不太明白mysqli尤其是它的功能,我们的   教授教我们关于mysql,而不是mysqli所以我需要帮助   如果可能的话,你可以在mysqli中重写它,感谢**

<?php
        include('/home/u545753064/public_html/classes/image_class.php');

        $obj_image = new Image();

        if(@$_POST['Submit'])
        {
            $obj_image->image_name=str_replace("'", "''", $_POST['txt_image_name']);
            $obj_image->image=str_replace("'", "''", $_POST['txt_image']);

            $obj_image->insert_into_image();

            $data_image=$obj_image->get_all_image_list();
            $row=mysqli_fetch_rows($data_image); 
        }

    ?>

    <!DOCTYPE html>
    <html>
    <head>
        <title>PHP IMAGE UPLOAD</title>
    </head>
    <body>
        <center><h1>PHP SCHOOL</h1></center>
        <center><h1>PHP IMAGE UPLOAD IN DATABASE</h1></center>

        <center>
            <form method="post" enctype="multipart/form-data">
                <table border="1" width="80%">
                    <tr>
                        <th width="50%">IMAGE NAME</th>
                        <td width="50%">
                        <input type="text" name="txt_image_name">   
                        </td>
                    </tr>
                    <tr>
                        <th width="50%">UPLOAD IMAGE</th>
                        <td>
                        <input type="file" name="txt_image">
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>
                            <input type="submit" name="Submit" value="SAVE">
                        </td>
                    </tr>
                </table>
            </form>
        </center>

        <?php
            if($row != 0)
            {
        ?>

        <center>
        <table width="80" border="1" >

                <?php
                $icount = 1;

                while ($data = mysqli_fetch_assoc($data_image)) 
                {
                ?>
                <tr>

                    <td style="text-allign:center" style="width:10%"><?php echo $icount; ?>
                    </td>
                    <td style="text-allign:center" style="width:10%"><?php echo $data['image_name']; ?>
                    </td>
                    <td style="text-allign:center" style="width:10%"><img src="images/<?php echo $data['image']; ?>" style="height:100px;" >
                    </td>
                </tr>
                <?php
                $icount++;
                }

                ?>
        </table>
        </center>   
        <?php
        }
        ?>
    </body>
    </html>

1 个答案:

答案 0 :(得分:0)

那是因为没有函数mysqli_fetch_rows() - 但是有mysqli_fetch_row(),它返回一行。