本文介绍了用于搜索mysql数据库的PHP脚本未返回结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
按照我编写的代码.即使表中包含关键字,也不会返回任何值.
Following the code I wrote. This doesn't return any values, even though the table has the keywords.
<?php
$conn = mysql_connect("localhost", "root", "qwerty");
mysql_select_db("mis", $conn);
$coursename=$_POST['coursename'];
$sql = "SELECT *
FROM course
WHERE coursename='$coursename'".
"ORDER BY coursename";
$rs = mysql_query($sql);
while($row = mysql_fetch_array($rs))
{
echo $row['coursename'];
};
?>
推荐答案
尝试在<?php
之后立即添加error_reporting(E_ALL);
,并查看是否从浏览器中收到任何错误消息.
Try to add error_reporting(E_ALL);
immediately after your <?php
and see if you get any error messages from your browser.
您应该能够找到问题的根本原因.
You should be able to track down the root cause of your problem.
您的课程做得好(我想;).
Good luck with your coursework (i guess ;).
这篇关于用于搜索mysql数据库的PHP脚本未返回结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!