<?php
mysql_connect("localhost", "root", "") or
die("Could not connect: " . mysql_error());
mysql_select_db("sdedecmsv57utf8sp1");
$result = mysql_query("SELECT title FROM dede_archives");
$file_index=1;
$i=1;
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
!$i%20 ? $file_index++ : $i++;
file_put_contents ( $file_index.'txt' , $row[0], FILE_APPEND );
}
mysql_free_result($result);
?>
mysql_connect("localhost", "root", "") or
die("Could not connect: " . mysql_error());
mysql_select_db("sdedecmsv57utf8sp1");
$result = mysql_query("SELECT title FROM dede_archives");
$file_index=1;
$i=1;
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
!$i%20 ? $file_index++ : $i++;
file_put_contents ( $file_index.'txt' , $row[0], FILE_APPEND );
}
mysql_free_result($result);
?>
!$i%20 ? $file_index++ : $i++;
換成
if($i%20==0){
$file_index++;
}
$i++;
因為無論是否產生新的$file_index,$i都需要增長
你看下是不是你想要的結果
要去掉还不行的话 只可能是数据库连接错误了
一个标题一行
不是链接在一起的