Hi all,
I am trying to insert over 10,000 rows into a database through a script. However, because of the size I presume, it doesn't work. It's meant to say what its added, with a small message next to it. It doesn't do anything.
My database has a list of pages on one of my websites. This script is meant to go to those pages and fetch the links off them and put them into a database.
<?php
//connect
$connect = mysql_connect("localhost", "user", "pass");
$yes = "yes";
//select db
mysql_select_db("dbname", $connect);
//query
$get = mysql_query("SELECT * FROM table");
for ($y=0; $y < mysql_num_rows($get); $y++) {
$row = mysql_fetch_assoc($get);
$urlname = $row['url'];
$data=join('', file($urlname));
preg_match_all('/(\/folder\/[^ >]+).(htm)/',$data, $result);
for ($i=0; $i<count($result[0]); ++$i) {
echo $result[0][$i] . "<br>";
if ($yes == "yes") {
$sql = "INSERT INTO table SET url='" . $result[0][$i] . "'";
}
if(mysql_query($sql))
{
echo "The information has been added.";
}
else
{
echo "There was an error submitting the information.";
}
}
}
?>
Does anyone have a solution? I really don't know an alternative.
Thanks a lot,
Michael