doudeng3008 2017-07-24 11:18
浏览 36

更改代码并修复它?

I know that I'm using multiple PHP styles, but I don't know how can I set this.

I think that there something wrong in exit(); and I don't know what to do to get the desired result.

<?php
    $mysqli = new mysqli("localhost", "root", "", "search");
       if(isset($_GET['search_button']))
            {
                $search = $_GET['search'];
                    if(search=="")
             {
                echo "<center> <b> Please write something in Search Box </b> </center>"

                exit();
             }

                $sql = "select * from website where site_key like '%$search%' limit 0, 5";

                $rs =  mysql_query($sql);

                 if(mysql_num_rows($rs)<1)
                {
                 echo "<center> <h4> <b> Oops !!! Sorry, there is no result found to related the word. </b> </h4> </center>";
                 exit();
                 }

                echo "<font size='+1' color='#1a1aff'> images for $search</font>";

                 while($row = mysql_fetch_array($rs))
                 {
                     echo   "<td>
                     <table style='margin-top: 10px'>
                        <tr>
                            <td>
                                <img src='img/$row[5]' height='100px'>
                            </td>
                         </tr>
                     </table>
                     </td>"
            }
            }
?>
  • 写回答

2条回答 默认 最新

  • dtyw10299 2017-07-24 11:28
    关注

    mysql_query($sql) should be mysqli_query($mysqli,$sql)

    (Connection parameter required for mysqli_query() )

    mysql_num_rows($rs) should be mysqli_num_rows($rs)

    mysql_fetch_array($rs) should be mysqli_fetch_array($rs)

    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题