douyan1244
2019-02-23 12:30
浏览 242
已采纳

如何在php中的foreach循环中使用两个数组或三个数组来插入数据库

How to insert multiple arrays with a foreach in rows of databases?

It's not a problem with an array, but my problem is to use two arrays or more.

my php code:

$checkBox1 = implode(',', $_POST['goinput1']);
$checkBox2 = implode(',', $_POST['goinput3']);
$mark3=explode(',', $checkBox1);
$mark4=explode(',', $checkBox2);
foreach($mark3 as $out3) 
{
    $sql_sub = "INSERT INTO sub_forms
                        (bord_mizban,bord_mihman) 
                VALUES ('$out3','$out4')";      
    if ($conn->query($sql_sub) === TRUE) {  

    } else {

    }   

}

** I want the out 4 variable insert to the database with the out 3 variable **

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题