php prepared statements with an array

前端 未结 3 1462
野性不改
野性不改 2020-12-09 14:32

i have a function to do a simple insert, but am trying to make the method more robust by passing an array. and this is the array i pass into it:

        $for         


        
3条回答
  •  没有蜡笔的小新
    2020-12-09 15:02

    Instead of bind_param (which in my mind is confusing at all times), just do:

    $stmt->execute($values);
    

    You can also get rid of your loop by using array_keys() and array_values()

提交回复
热议问题