求大神指点排错:php+mysql一个简单的查询验证

WBOY
Release: 2016-06-13 12:17:49
Original
995 people have browsed it

求大神指导排错:php+mysql一个简单的查询验证
这个是链接mysql的代码,文件名为link.php
$link=mysql_connect(SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_PASS);
    mysql_select_db(SAE_MYSQL_DB,$link);
mysql_query("set names utf8");
?>
这段是用SQL语句查询的代码,文件名为testmysql.php
include("link.php");
$name = $_GET['name'];
$ticketid = $_GET['ticketid'];
$id=$_GET['id'];
$result = mysql_query("SELECT  * FROM 1 WHERE 姓名='$name' AND 准考证号='$ticketid' AND 身份证号='$id'",$link);
while( $row=mysql_fetch_array($result) ){
echo $row['姓名'] . " " . $row['准考证号'];
echo "
";
}
mysql_close($link);
?>
运行后给出的警告:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in Query/testmysql.php on line 7

------解决思路----------------------
用中文 做字段名称好像不是很好,都说第七行错误,自己判断下吧~
------解决思路----------------------
mysql_query执行错误,检查下SQL语句是否正确。
------解决思路----------------------
打印下result看是不是资源类型
------解决思路----------------------

引用:
Quote: 引用:

mysql_query执行错误,检查下SQL语句是否正确。


我开始也怀疑是这个问题,但是,我用sql语句在数据库软件上查询是对的呀!


变量用{}包起来
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!