01
|
<?php
|
02
|
03
|
$m = mysql_connect( '127.0.0.1' , 'root' , '' ) or die ( "Invalid query: " . mysql_error());
|
04
|
05
|
mysql_select_db( 'discuz' , $m ) or die ( "Invalid query: " . mysql_error());
|
06
|
07
|
08
|
$handle = fopen ( "aa.txt" , "r" );
|
09
|
while (! feof ( $handle )) {
|
10
|
$buffer = ( $handle );
|
11
|
$ss [] = explode ( ' ' , $buffer );
|
12
|
|
13
|
}
|
14
|
//var_dump($ss);
|
15
|
16
|
mysql_query( "set names 'utf8'" , $m );
|
17
|
foreach ( $ss as $k => $v ){
|
18
|
//addslashes($v);
|
19
|
//foreach($v as $k = $value){
|
20
|
//$vv = addslashes($value);
|
21
|
//mysql_query("insert into match_view_test_2 (`kanum`, `username`, `mid`, `rank`, `num` ,`zunum` ,`sex` ,`yucolor` ,`eye` ,`backtime` ,`kongju` ,`fengspeed` )
|
22
|
//values ('123','123', 20111014060110765 ,1,'123','123','123','123','123','123','123','123')") or die("Invalid query: " . mysql_error());
|
23
|
//}
|
24
|
$kanum = $v [1];
|
25
|
$username = $v [2];
|
26
|
|
27
|
$rank = (int) $v [0];
|
28
|
|
29
|
$num = $v [3];
|
30
|
$zunum = $v [4];
|
31
|
$sex = $v [5];
|
32
|
//echo $sex;
|
33
|
$yucolor = $v [6];
|
34
|
//$eye = $v[7];
|
35
|
$backtime = $v [8]. ' ' . $v [9];
|
36
|
$kongju = $v [10];
|
37
|
$fengspeed = $v [11];
|
38
|
mysql_query("insert into match_view_test (`kanum`, `username`, `mid`, `rank`, `num` ,`zunum` ,`sex` ,`yucolor` ,`eye` ,`backtime` ,`kongju` ,`fengspeed` )
|
39
|
VALUES( '$kanum' , '$username' , 20111014060110765, $rank , '$num' , '$zunum' , '$sex' , '$yucolor' , '$eye' , '$backtime' , '$kongju' , '$fengspeed' ) ") or die(" Invalid query: " . mysql_error());
|
40
|
}
|
41
|
|
时间: 2024-10-31 13:55:01