2 thoughts on “PHP Tutorial – #93 – How to Insert Multiple Records Using Prepared Statements (PDO)

  1. Looking at how incredibly much code you need to create just for the sake of inserting multiple values, this is really making me think to stick with static queries after all…
    I've never been a big fan of prepared statements but figured it was about time to move on to it… However, looking at this, I'm just going; wat?

    — My db class can perfectly prevent SQL-injection on its own. (Honestly, it really isn't that hard!)
    — I don't need the performance cost of 5 loops to insert multiple values
    — I don't need to use 5 different functions to trigger 1 query
    — I don't have any overhead.
    — prepared statements increase the speed of queries in a loop? Pfff, queries in a loop are bad practice.

    The above reasons are enough for me to go "let's forget about prepared statements again"

    Now, this leaves me wondering, could you convince me to like prepared statements? I mean, am I wrong here? (Note that I'm very set on efficient code. Every ms matters)

Leave a Reply

Your email address will not be published. Required fields are marked *