我不知道为什么会出现此错误:mysql_num_row():supplied argument is not a valid MySQL result resource
$sqlCheckLevel = 'SELECT * FROM levelPerClass WHERE clsId = \''.$class.'\' AND lvlId = \''.$rowLevel['lvlId'].'\'';
$resCheckLevel = mysql_query($sqlCheckLevel);
print_r($rowCheckLevel = mysql_fetch_assoc($resCheckLevel));
//prints 'Array ( [clsId] => 15 [lvlId] => 18 )'
if(mysql_num_rows($rowCheckLevel) == 0) {
//etc
有什么问题?
修改 我觉得我好笨。 它必须是
if(mysql_num_rows($resCheckLevel) == 0) {
答案 0 :(得分:2)
使用like,
mysql_num_rows($resCheckLevel)
而不是
mysql_num_rows($rowCheckLevel)