I crawled pdf link from web, I want to copy the pdf that doesn’t exist yet in database by check out the name of document (that I get from link) with the name of document that exist in database.
here’s the code :
$input = explode(" ",trim(basename($pdfLink, ".pdf"),"() "));
$sql = mysql_query("SELECT doc_name FROM tb WHERE doc_name ='$input'")or die(mysql_error());
if (!$sql){
copy($pdfLink, $savePath . basename($pdfLink));
}
$pdfLink is string of PDFlinks. but, copy process didn’t work. what’s wrong? thank you 🙂
It is better for you to check count of related records in DB
or to count affected rows: