显然我有错误,因为这个查询不会执行,任何人都可以看到原因吗?
$username=username;
$mysqli = @new mysqli($localhost, $user, $pass, $database);
$sql = "SELECT * FROM player_log WHERE user = '$username'AND log_status=online";
$result = $mysqli->query($sql);
if ($result->num_rows > 0){
echo "its works";
}
答案 0 :(得分:1)
添加了调用mysqli的标准方法($username
之后的空格不是问题)
$username=username;
$mysqli = @new mysqli($localhost, $user, $pass, $database);
$sql = "SELECT * FROM player_log WHERE user = '$username'AND log_status='online' ";
if ($result = $mysqli->query($sql)){
printf("Select returned %d rows.\n", $result->num_rows);
/* free result set */
$result->close();
echo "its works";
}