i want to insert the contents of some text files into database, but it failed. please help me, thank you very much. :)
<?php
function saveContent($url){
set_time_limit(0);
foreach ($url as $file =>$files) {
$handle= fopen($files, "r") or die ('can not open file');
$content = file_get_contents($files);
//insert into database
$q0 = mysql_query("INSERT INTO tb_document (doc_id, namefiles, content) VALUES('','$files','$content') ");
fclose($handle);
}
}
$path_to_check = 'C:/Appserv/www/textsumm2/textsumm/try/';
$url = glob($path_to_check.'*.txt');
$a = saveContent($url);
?>