警告:输入中的意外字符:"(ascii = 29)state = 0 in [英] Warning: unexpected character in input: " (ascii=29) state=0 in

查看:97
本文介绍了警告:输入中的意外字符:"(ascii = 29)state = 0 in的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读别人对这个错误所做的事情,并对我的php.ini文件进行了更改,添加了代码以覆盖另一个php设置,但最终仍然遇到相同的错误.这是我的代码:

I've been reading about what others have done with this error and have made changes to my php.ini file, added code to override another php setting, and still end up with this same error. Here is my code:

 <html>
 <body>
 <table>

 <?php error_reporting (E_ALL ^ E_NOTICE); ?>

 <?php

     function getRecords($query) {
         $con = mysql_connect("localhost", "movie", "moviepw");
         if (!$con)
         {
            die('Could not connect: ' . mysql_error());
         }

         mysql_select_db("movies", $con);

         $result = mysql_query($query);

         // THE ERROR IS REPORTED ON THIS LINE
         return $result;

}

          function buildQuery()  {

                    $keyword = $_GET['keyword'];

                    $sql = "SELECT * from movies WHERE
                            (
                            'movie_title' LIKE '%keyword%'
                            OR
                            'movie_description' LIKE '%keyword%'
                            )";

                    return $sql;  

        }

         $query = buildQuery();

         $records = getRecords($query);

         while($row = mysql_fetch_array($records)){ ?>

 <tbody>
          <table border='1'>

            <tr>
                   <td><?= $row['movie_title']; ?></td>
                   <td><?= $row['movie_rating']; ?></td>
                   <td> <img src="<?= $row['movie_image'];?>"> </td>
                   <td><?= $row['movie_description']; ?></td>
                   <td><a href="movie_index.php">Return to Search</a></td>
            </tr>

<? }  ?>

</tbody>

</table>
</body>
</html>

知道为什么我会收到此错误吗?

Any idea why I'm getting this error?

推荐答案

编辑器添加了不可删除的空格.我不得不删除几行并重写它们.因此,此问题与代码不完全相同,仅是文本编辑器软件问题.

The editor had added spaces that were not deletable. I had to delete several lines and rewrite them. So, this issue wasn't exactly with the code...just a text editor software problem.

我遇到的另一个错误是查询的布尔错误.原来我试图查询数据库而不是表.

The other error I had was a boolean error with my query. Turns out I was trying to query the database instead of the table.

感谢您提供的所有帮助!

Thanks for all the help with this!

这篇关于警告:输入中的意外字符:"(ascii = 29)state = 0 in的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆