I\'m writing a database class for my website with functions such as fetchOne
, fetchAll
which prepare, execute (+ bind), and fetch the query all in
you would not want to "re-prepare" the same query multiple times. this is the purpose of the prepare statement. you prepare it once, bind the variable(s), then you simply switch the variables' values and re-execute each iteration of the loop.
http://www.php.net/manual/en/pdostatement.bindparam.php
doing it this way will greatly increase your performance over alternative methods.