PHP how to read txt text content stored in MySQL database!
This post was last edited by Pigpighappy on 2012-12-17 17:07:47
Ask the great God to answer Ah! How does PHP read txt text content into MySQL database? Please complete the code! Fit to add points! The little woman thanked her!
------Solution--------------------
This depends on your txt in the database field is not written by the way if it is good to do, I do, I use TXT to add the e-mail address
Only one address is required per line
Upload txt text
if ($_files[' text ' [' name ']) {
$path = '. /upload ';
if (!file_exists ($path)) {
mkdir ($path);
}
if (!is_dir ($path)) {
mkdir ($path);
}
$p =strrchr ($_files[' text ' [' name '], '. ');
if (Preg_match ("/txt/", $p)) {
$file = $path. ' /'. Date (' Ymd '). Time (). $p;
Move_uploaded_file ($_files[' text ' [' Tmp_name '], $file);
$get =fopen ($file, ' R ');
$j = 0;
while (!feof ($get)) {//loops through each row
$row =fgets ($get);
$row =str_replace ("', '", $row);
$rowa =preg_match ("/\@/", $row);
$sql = "INSERT into ' address ' (' address ', ' timees ', ' data ') VALUES ('". $rowa. "', ' 0 ', 1)";
$db->guery ($sql);
$j + +;
}
}
echo "";
}
}else{
echo "";
}
Fclose ($get);