当前位置:Gxlcms > PHP教程 > php+mysql有数据,但查询不到数据有关问题

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

时间:2021-07-01 10:21:17 帮助过:18人阅读

php+mysql有数据,但查询不到数据问题
一小段程序,在本地完全正常,传到服务器上执行时就是查不到数据,但在远程phpMyAdmin中用SQL方式查询也能查询得到,搞不懂了,有过类似经历的来帮忙啊.代码如下:
$query = "select name,class,schoolid from studentslist where class like '$query_class' and name like '$query_name' ";

echo $query.'
';

$result = MySql_query($query, $id);

// if($result)echo 'query success';

$totalnum = MySql_num_rows($result);
echo $totalnum.' records found.';
if ($totalnum < 1) {
echo "

未找到 " . $query_class . " 班姓名为 " . $query_name . " 的学生记录。

";
}

分享到:


------解决方案--------------------
可能是编码的问题,加上: mysql_query("set name utf8"); 看看

人气教程排行