I've been urging to know what is the difference between using bindValue and execute(array()) thing-y.
Well let's say I have this example of code
$query = $db->prepare("SELECT embedded_page.uid FROM embedded_page WHERE fbp_id = :fbp_id");
$query->bindValue(":fbp_id", $fbp_id, PDO::PARAM_INT);
$query->execute();
What is the difference between this one?
$query = $db->prepare('SELECT `embedded_page`.`uid`, `embedded_page`.`ticket_id`, `embedded_page`.`event_table` FROM `embedded_page` WHERE `fbp_id` = ?');
$query->execute(array($fbp_id));
Regardless of saving a line of code.
A help would be appreciated.
It is already self explained with your example, That bindValue validate input data type in form of specially defined PDO::PARAM_INT or similar. While in second example no such condition in place as prepare using ?. (Some internal validation may be done by engine assuming for string, int and float types.). Also in case of more variables as place holders in query first form is easier to understand.