PHP+MYSQL问题
if(empty($category))
{
$category=热点;
}
$str_sql="select * from $tablename where category='$category' order by date desc" ;
echo $str_sql;
$result=mysql_db_query($dbname,$str_sql,$link_id) or die(mysql_error());
echo $result;
if(!$result)
{
print('MySQL 选择命令执行错误');
exit();
}
$number_of_rows=@mysql_num_rows($result);
这是我的一段PHP+MySQL程序,echo $result结果为:select * from news where category='热点' order by date desc
我将这段SQL语句在MYSQL中能正确运行,但是在这里却不行这是为什么呢?
在$result=mysql_db_query(...)这句出来的结果确是:
Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='
刚刚接触PHP,不知道这个问题该怎么解决,请高手帮忙!~~谢谢