PDO update table using array

后端 未结 2 1758
北海茫月
北海茫月 2021-01-26 17:53

I\'m learning and new in PDO. The usage of array in PDO causes difficulty for me. I\'m developing simple web application using PDO syntax. Everything is going on smoothly, but I

2条回答
  •  感情败类
    2021-01-26 18:25

    How about you prepare the statement outside the loop, then bind the values within the loop and execute.

    prepare($sql);
    
        foreach($roll as $key => $n){
            $query->bindParam(':roll', $n[$key]);
            $query->bindParam(':name', $name[$key]);
            $query->execute();
        }
    }
    

提交回复
热议问题