Hi all,
I'm trying to add each part of an array to a database. Like array[0] in one row, array[1] in the next etc.
It's not working though. Here is my code:
preg_match_all('/(http:\/\/www.example.com\/folder\/[abc])/',$data, $result);
for ($i=0; $i<count($result[0]); ++$i) {
echo $result[0][$i] . "<br>";
if ($yes == "yes") {
$sql = "INSERT INTO urls SET url='$result[0][$i]'";
}
if(mysql_query($sql))
{
echo "The information has been added to the database.";
}
else
{
echo "There was an error submitting the information.";
}
}
Instead of adding what the array 'result' contains, it justs adds Array[0], Array[1] etc in each row.
Does anyone know what the problem is?
Thanks a lot,
Michael