Foreach loop with multiple arrays

前端 未结 7 1877
南旧
南旧 2021-01-01 03:50

This is what I want:


foreach($_POST[\'something\'] as $something){
    foreach($_POST[\'example\'] as $example){
        $query = mysq         


        
7条回答
  •  余生分开走
    2021-01-01 04:40

    Do you mean something like:

    foreach($_POST['something'] as $key => $something) { 
        $example = $_POST['example'][$key];
        $query = mysql_query("INSERT INTO table (row, row2) VALUES ('{$something}','{$example}')"); 
    } 
    

提交回复
热议问题