I'm working on a php on localhost where from the root folder it will be to read all the files and folders and insert into a MYSQL based but I'm having difficulties Can someone help? obrgd;)
/*CONNECT DB */
$link = mysqli_connect("localhost", "root", "usbw", "beifaserver") or die("Error " . mysqli_error($link));
mysqli_query($link,"delete from search");
/*CLEAN DB TABLE*/
function listFolderFiles($dir){ /*READ DIR/ File*/
$ffs = scandir($dir);
echo '';
foreach($ffs as $ff){
if($ff != '.' && $ff != '..'){
echo '';
if(is_dir($dir.'/'.$ff)){
echo $ff;
listFolderFiles($dir.'/'.$ff);
}
else{
echo ''.$ff.'';
$try = mysqli_query($link,"INSERT INTO search (title,url, dategrab)VALUES ('".$ff."', '".$dir."/".$ff."', '".date('2004-m-d H:i:s')."')");
if($try === false){
echo 'error - ';
echo mysqli_error($link);
}
}
echo '';
}
}
echo '';
}
listFolderFiles('../');
?>