我知道已经回答了类似的问题,但是在我的情况下,我没有使用布尔值,但出现此错误
警告:mysql_num_rows() 期望参数 1 是资源,在第 19 行的 /home3/arm103/public_html/battle.php 中给出 null
这是从第1行到第25行的battle.php
<?php
session_start();
include("header.php");
if(!isset($_SESSION['uid'])){
echo "You must be logged in to view this page!";
}else{
if(isset($_POST['gold'])) {
$energy = protect($_POST['energy']);
$id = protect($_POST['id']);
$user_check = mysql_query("SELECT * FROM `stats` WHERE `id`='".$id."'") or die(mysql_error());
if(mysql_num_rows($user_check) ==0) {
output("There is no user with that ID!");
}elseif($energy < 1 || $energy > 10) {
output("You must attack with 1 - 10 energy!");
}elseif($energy > $stats['energy']){
output("You do not have enough energy!");
}elseif($id == $_SESSION['uid']) {
output("You can not attack yourself!");
}elseif(mysql_num_rows($attacks_check) > 9) {
output("This person has been already attacked the maximum of 10 times in the last 24 hours!");
}else{
$enemy_stats = mysql_fetch_assoc($user_check);
$attack_effect = $energy * 0.1 * $stats['attack'];
$defence_effect = $enemy_stats['defence'];
如果有人能告诉我问题,那就太好了谢谢