<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新用户统计</title>
</head><body>
<h1>内容区域</h1>
<hr/>
<?php
 //include_once('DBHelper.php');
 //echo '1';
 $day=time();
 $rangeday=$day-86400*100;
    echo $rangeday;
 
 @ $db = new mysqli('localhost', 'root', 'he251251', 'test');
 $query="select * from data_players where reg_time>= $ranggeday";
 echo $query;
 if (mysqli_connect_errno()) 
   {
      echo 'Error: Could not connect to database.  Please try again later.';
      exit;
   }
 //echo '<br/>';
 //echo '2222';
 //echo '<br/>';
    $result = $db->query($query);
 $num_results=$result->num_rows;
 echo $num_results;
 echo '<p>Number of records found:'.$num_results.'</p>'
 //for($i=0;$i<$num_results;$i++)
 for ($i=0; $i <$num_results; $i++)
 {
  $row=$result->fetch_assoc();
  echo '<p><strong>'.($i+1).'.Name:';
  echo htmlspecialchars(stripslashes($row['uname']));
  echo '</p>';
   }?>
</body>
</html>我测试乐一下,这段代码有2个错误,$query="select * from data_players where reg_time>= $ranggeday";这里打印出来是$query="select * from data_players where reg_time>= ;
我填一个数字会继续执行到for循环那里,页面直接没有反映了。把FOR语句注释掉仍然可以打印前面的语句,请问错在哪??