<?php
set_time_limit(0);
$fileName = 'testx.txt';
$startTime = '1';
$endTime = '2';
$link = mysql_connect('ip:port', 'user', 'password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db('dbname', $link) or die ('Can\'t use foo : ' . mysql_error());
$res = mysql_query ( 'show tables;', $link);
$return = array();
$tables = array();
while($row=mysql_fetch_array($res)) {
$return[] = $row;
}
foreach( $return AS $key => $item ){
$table = $item[0];
if( strstr($table, 'table name') !== false ){
$tables[] = $table;
}
}
$baobiao = array();
$sql = 'select 1,2 from ';
foreach( $tables AS $table ){
$temp = $sql.$table.' where 1=1 and tieba_video_url != \'\' ';
$res = mysql_query ($temp, $link);
$str = '';
while($row=mysql_fetch_array($res)) {
if( $row['row_name'] > 0 ){
$post_id = $row['row_name'];
$str.=$post_id."_".$row['row_b']."\r\n";
}
}
file_put_contents($fileName,$str,FILE_APPEND);
usleep(1000);
}
mysql_close($link);
echo "OK";
转载请注明原文地址: https://www.6miu.com/read-74689.html