这是我当前的 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.
)
)
我正在尝试将每个输出作为新行插入表中,但它认为每个 [0] [1] [2] 都是一个新列。如何将数组插入mysql?
$query = "INSERT INTO table (col1) VALUES ";
foreach ($matches as $item) {
$query .= "('".$item[0]."'),";
}
$query = rtrim($query,",");
$result = mysql_query($query);
上面显然只插入了数组的第一行