Php 错误:";“数组到字符串的转换”内爆函数

Php 错误:";“数组到字符串的转换”内爆函数,php,Php,脚本: <?php if(isset($_POST['submit'])) { $some_text_1 = $_POST['some_text_1']; $some_text_2 = $_POST['some_text_2']; $some_text_3 = $_POST['some_text_3']; $myarray = array($some_text_1, $some_text_2, $some_text_3); for ($i =

脚本:

<?php

if(isset($_POST['submit'])) {

    $some_text_1 = $_POST['some_text_1'];
    $some_text_2 = $_POST['some_text_2'];
    $some_text_3 = $_POST['some_text_3'];

    $myarray = array($some_text_1, $some_text_2, $some_text_3);

    for ($i = 0; $i < count($myarray); $i++) {

        $tqs = "INSERT INTO `table` (`some_text`) VALUES ('" . $myarray[$i] . "')";
        $tqr = mysqli_query($dbc, $tqs) or die(mysqli_error($dbc));


        $tqs = "SELECT `id` FROM `table`  WHERE `some_text` = '" . $myarray[$i] . "'";
        $tqr = mysqli_query($dbc, $tqs) or die(mysqli_error($dbc));
        $fetch_array[] = mysqli_fetch_array($tqr);

    }

    $fetch_array = implode(", ", $fetch_array);

?>
尽管在使用内爆函数时,我遇到了以下错误:

Notice: Array to string conversion in ... (points to the implode function)
有关如何使其工作的任何建议?

需要一个字符串数组作为第二个参数。你给它一个数组

你可以用这样的方法来解决这个问题(只是一个例子):


mysqli\u fetch\u array
返回一个数组–因此在
$fetch\u array
中有一个数组数组,这就是
内爆
所抱怨的。如果每行只需要一个列值,那么在每个循环迭代中将该值作为新元素放入
$fetch\u array
中。您应该阅读sql注入和准备好的语句。
Notice: Array to string conversion in ... (points to the implode function)
$row = mysqli_fetch_array($tqr);
$fetch_array[] = row['id'];