php實現mysql資料庫隨機重排例子
程式碼
| 代碼如下 |
|
|
//資料庫連接就不寫在這裡面了
$s = isset( $_GET['s'] )?$_GET['s']:0;
$e = isset( $_GET['e'])?$_GET['e']:50;
$count =85000;
if( $s < $count )
{
$sql = "select * from 表首碼_info where isget =0 order by id desc limit $s,$e ";
$query = mysql_query( $sql );
while( $rs = mysql_fetch_array( $query ) )
{
$id = $rs['id'];
$sss = $rs['sss'];
$typeid = $rs['typeid'];
$isget = $rs['isget'];
$sql = "insert into 表首碼_info_bak (id,表首碼,typeid,isget) values('$id','$sss','$typeid','$isget')";
mysql_query( $sql ) ;
echo $sql;
//exit;
$sqlu = "update 表首碼_info set isget=1 where id =".$rs['id'];
mysql_query( $sqlu );
}
echo '正在處理資料,當前為'.$s.'條......';
}
else
{
echo '完成所有資料處理 再隨機排序一次';
}
?> |
http://www.bkjia.com/PHPjc/895098.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/895098.htmlTechArticlephp實現mysql資料庫隨機重排例子 程式碼 代碼如下 ? //資料庫連接就不寫在這裡面了 $s = isset( $_GET['s'] )?$_GET['s']:0; $e = isset( $_GET['e'])?$_GET...