首页 > 代码库 > mysql获取600000条数据

mysql获取600000条数据

<?php
set_time_limit(0);
header("Content-Type: text/html; charset=utf-8");
$newcon = mysql_connect(‘host‘, ‘user‘, ‘pwd‘);
$html =  ‘<html><head></head><body><div style="margin-top:10px;" id="dataarea"><table border="1"><tbody><tr><th>列名</th></tr><tr>‘;
echo $html;
static  $i = 600000;
static  $j = 0;
if ($newcon) {
  if (mysql_select_db("db", $newcon)) {
      for($i;$i<600000;$i++){
      $sql = "select x,y,z from userinfo_10022 where UserID = $i";
      $result = mysql_query($sql, $newcon);
      if ($result) {
        while ($trow = mysql_fetch_array($result)) {
          if($j%5 == 0){
           echo ‘</tr><tr>‘;
          }
          $j++;
          if($j> 20){die (‘ok‘);}
          echo ‘<td>‘.$trow[‘x‘].‘</td>‘;
        }
      }
    }
  }
  mysql_close($newcon);
}
echo ‘</tr></tbody></div></body><html>‘;

?>

 

mysql获取600000条数据