'SET NAMES '.DB_CHAR, ); try{ $dbh = new PDO($dsn,DB_USER,DB_PASS,$options); }catch (PDOException $e) { die('PDO ERROR!'); } $sql='SELECT COUNT(-1) FROM `'.$table.'`;'; $do=$dbh->query($sql); if($do){ $count=$do->fetch(); }else{ die('PDO COUNT ERROR'); } $limit_end=($limit_end)?$limit_end:$count[0]; $limit_end=$limit_end-$limit_start; $limit_length=$limit_end>$limit_length?$limit_length:$limit_end; $section=ceil($limit_end/$limit_length); if (ob_get_level() == 0){ ob_start(); }else{ die('PDO ERROR'); } for($i=0;$i<$section;$i++){ $sql='SELECT '.$filed.' FROM '.$table.' LIMIT '.($limit_start+1+$i*$limit_length).','.$limit_length.';'; $s=$dbh->query($sql); $arr=$s->fetchALL(PDO::FETCH_ASSOC); foreach ($arr as $value) { echo(implode(' ', $value)."\n"); } ob_end_flush(); } }else{ $link=mysql_connect(DB_HOST.':'.DB_PASS,DB_USER,DB_PASS); if($link){ mysql_select_db(DB_NAME,$link); mysql_query('SET NAMES '.DB_CHAR); $sql='SELECT COUNT(-1) FROM `'.$table.'`;'; $count=mysql_fetch_array(mysql_query($sql)); $limit_end=($limit_end)?$limit_end:$count[0]; $limit_end=$limit_end-$limit_start; $limit_length=$limit_end>$limit_length?$limit_length:$limit_end; $section=ceil($limit_end/$limit_length); if (ob_get_level() == 0){ ob_start(); }else{ die('MYSQL ERROR'); } for($i=0;$i<$section;$i++){ $sql='SELECT '.$filed.' FROM '.$table.' LIMIT '.($limit_start+1+$i*$limit_length).','.$limit_length.';'; $a=mysql_query($sql); if($b=mysql_fetch_row($a)){ do{ echo(implode(' ', $b)."\n"); }while($b=mysql_fetch_row($a)); } ob_end_flush(); } }else{ die('MYSQL ERROR!'); } } ?>