A prepared statement is a template for executing one or more SQL queries against the database. The idea behind prepared statements is that, with queries that use the same syntax but different values, it is much faster to pre-process the syntax once and then execute it several times using different parameters. Consider the following task. We have to insert the names of several new authors into our database. Of course, we can use command line client or the add author
page we recently created, but we decide to use a PHP script.
Let's assume that the authors to be added are kept in a PHP array:
$authors = array( array( 'firstName' => 'Alexander', 'lastName' => 'Dumas', 'bio' => 'Alexandre Dumas was a French writer, best known for his numerous historical novels of high adventure which have made him one of the most widely read French authors in the world.'), array( 'firstName' => 'Ivan', 'lastName' => 'Franko', 'bio' => 'Ivan Franko was a Ukrainian poet, writer...