-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdump_TW_record.php
More file actions
40 lines (32 loc) · 789 Bytes
/
Copy pathdump_TW_record.php
File metadata and controls
40 lines (32 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/* this program calculate the probability of the url1 to url2
*/
include("connection.php");
mysql_select_db($database_cnn,$b95119_cnn);
$tb_name = $argv[1];
$outfile = $argv[2];
$fp = fopen($outfile, "w");
if ($fp == null){
printf("%s can't be write",$outfile);
return 0;
}
$query = sprintf("select * from `%s`",$tb_name);
mysql_query($query) or die(mysql_error());
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_row($result)) {
$total_column = count($row);
for ($i = 0; $i< $total_column - 1; $i++){
if (!empty($row[$i])){
fprintf($fp, "%s\t", $row[$i]);
}else{
fprintf($fp, "NULL\t", $row[$i]);
}
}
if (!empty($row[$i])){
fprintf($fp, "%s\n", $row[$i]);
}else{
fprintf($fp, "NULL\n", $row[$i]);
}
}
fclose($fp);
?>