This is my current output from a preg_match_all
Array
(
[0] => Array
(
[0] => 2 Sentence text here
)
)
Array
(
[0] => Array
(
[0] => 3 Sentence text here.
[1] => 4 Sentence text here.
[2] => 5 Sentence text here.
)
)
I'm trying to insert each output as a new row in a table but it's thinking that each [0] [1] [2] is a new column. How do I insert the array into mysql?
$query = "INSERT INTO table (col1) VALUES ";
foreach ($matches as $item) {
$query .= "('".$item[0]."'),";
}
$query = rtrim($query,",");
$result = mysql_query($query);
The above obviously only inserts the first row in of the array