I want to save 10.000 pages in my site's database.
When I run the file, this error occurs for every page.
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '_trackPageLoadTime']);(function() {var ga = document.createElement("script"); ga' at line 1
I think there are some characters that are causing the error.
savedb.php
<?php
include "conexao.php";
for ($nr=1; $nr<=10000; $nr++){
$url = "http://www.site.com/u$nr";
$html = file_get_contents($url);
set_time_limit(120);
$tabela_bd = "paginas";
$sql = mysql_query("INSERT INTO $tabela_bd(html) VALUES('$html')");
if ($sql) {echo "Cadastrado com sucesso!!";
} else {
echo "Falha ao cadastrar.".mysql_error();
}
}
?>
@edit Solved my problem with characters, but now some tables are being saved without content.