Expanding on the response of the AO, the following rules also apply:
$sql = $db->prepare("INSERT INTO db_fruit (id, type, colour) VALUES (? ,? ,?)"); $sql->execute(array($newId, $name, $color));
and
$sql = $db->prepare("INSERT INTO db_fruit (id, type, colour) VALUES (:id, :name, :color)"); $sql->execute(array('id' => $newId, 'name' => $name, 'color' => $color));
It might be a personal preference, but I find this syntax a lot cleaner.
source share