Home >Backend Development >PHP Tutorial > php+mysql有数据,但查询不到数据有关问题

php+mysql有数据,但查询不到数据有关问题

WBOY
WBOYOriginal
2016-06-13 12:37:281123browse

php+mysql有数据,但查询不到数据问题
一小段程序,在本地完全正常,传到服务器上执行时就是查不到数据,但在远程phpMyAdmin中用SQL方式查询也能查询得到,搞不懂了,有过类似经历的来帮忙啊.代码如下:

$query = "select name,class,schoolid from studentslist where class like '$query_class' and name like '$query_name' ";<br />
			<br />
			echo $query.'<br>';<br />
                        <br />
			$result = MySql_query($query, $id);<br />
<br />
//			if($result)echo 'query success';<br />
<br />
                        $totalnum = MySql_num_rows($result);<br />
echo $totalnum.' records found.';<br />
                        if ($totalnum < 1) {<br />
                            echo "<p align=left>未找到 " . $query_class . " 班姓名为 " . $query_name . " 的学生记录。</p>";<br />
                        } 

Statement:
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