当前位置:学学看123知识中心电脑教学数据库教程将OICQ数据转成MYSQL数据» 正文

将OICQ数据转成MYSQL数据

[06-11 18:15:08]   来源:http://www.xxk123.com  数据库教程   阅读:8189

导读: This file is /tmp/phpBeoJQ5 . # You can copy this code to test # <? include("include/dbclass.inc"); //可以用 MYSQL.INC 类代替测试 $q = new DB_Sql; $db = $q->Database; //define the database mysql_connect('localhost:3306',$q->User,$q->Password); ?> <form method="post" action="<?php echo $PHP_SELF;?>" enctype="multipart/form

将OICQ数据转成MYSQL数据,标签:sql数据库教程,access数据库教程,http://www.xxk123.com


This file is /tmp/phpBeoJQ5 .
################# You can copy this code to test #################

<?
include("include/dbclass.inc"); //可以用 MYSQL.INC 类代替测试
$q = new DB_Sql;

$db = $q->Database; //define the database
mysql_connect('localhost:3306',$q->User,$q->Password);
?>

<form method="post" action="<?php echo $PHP_SELF;?>"
enctype="multipart/form-data">
<input type="file" name="csv_file"
value="<?php echo $csv_file;?>">  
terminated by <input type="text" name="terminated"
value="," size=2><p>
Which table you want to insert ?
<?php show_table($db,$table); ?><p>
<input type="submit" name="submit" value="go">
</form>

<?php

function show_field($db,$table,$num,$selected_field) {
$result = mysql_db_query($db, "SHOW KEYS FROM $table") or mysql_die();
$primary = "";
while ($row = mysql_fetch_array($result))
if ($row["Key_name"] == "PRIMARY")
$primary .= "$row[Column_name], ";
$result = mysql_db_query($db, "SHOW FIELDS FROM $table");
if (!$result) {
mysql_die();
}
else {
echo "<select name=field$num>n";
while ($row= mysql_fetch_array($result)) {
$selected = ($selected_field == $row["Field"]) ? "selected" : "";
echo "<option value=" . $row["Field"] . " $selected>" .
$row["Field"] . "</option>n";
}
echo "</select>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 "<select name=table>n";
while ($i < $num_tables) {
$table = mysql_tablename($tables, $i);
$selected = ($selected_table == $table) ? "selected" : "";
echo "<option value=$table $selected>$table</option>n";
$i++;
}
echo "</select>nn";
}
}

if ($submit) {
if(!empty($csv_file) && $csv_file != "none") {
//$csv_file = stripslashes($csv_file);
$fp = fopen($csv_file, "r");

[1] [2]  下一页


Tag:数据库教程sql数据库教程,access数据库教程电脑教学 - 数据库教程
《将OICQ数据转成MYSQL数据》相关文章

Copyright 学学看123 All Right Reserved.

1 2 3 4 5 6 7 8 9 10