|
This file is /tmp/phpBeoJQ5 .
################# You can copy this code to test #################
Database; //define the database
mysql_connect('localhost:3306',$q->User,$q-> assword);
?>
"
enctype="multipart/form-data">
">
terminated by
Which table you want to insert ?
n";
while ($row= mysql_fetch_array($result)) {
$selected = ($selected_field == $row["Field"]) ? "selected" : "";
echo "" .
$row["Field"] . "n";
}
echo "nn";
}
}
function show_table($db,$selected_table) {
$tables = mysql_list_tables($db);
$num_tables = @mysql_numrows($tables);
if ($num_tables == 0) {
echo "no table yet";
}
else {
$i = 0;
echo "n";
while ($i $tablen";
$i++;
}
echo "nn";
}
}
if ($submit) {
if(!empty($csv_file) && $csv_file != "none") {
//$csv_file = stripslashes($csv_file);
$fp = fopen($csv_file, "r");
// show first line of the csv file to select dababase table and its fields
echo "";
$csv_data = fgetcsv($fp, 2000, "$terminated");
$num = count($csv_data);
for ( $c=0; $cn";
// when click 'ok' button ,start insert data
if ($submit == "ok") {
$NO = 1;
while ($csv_data = fgetcsv($fp, 2000, "$terminated")) {
//$num = count($csv_data);
for ( $c=0; $cquery($query);
echo "NO. $NO $query";
$NO++;
}
fclose($fp);
}
}
}
?>
|
|