-1
我想讓我的SQL調用更安全,我遇到了2種準備語句的方法,我想知道它們之間是否有任何區別。PHP MYSQL編寫語句 - 區別
這是查詢:
$query =
"INSERT INTO companies
VALUES(
NULL,
:name,
:assignation,
:priority
)";
1)
$statement = $pdoDbInstance->prepare($query);
$statement->bindValue(':name', $name);
$statement->bindValue(':assignation', $assignation);
$statement->bindValue(':priority', $priority);
$result = $statement->execute();
2)
$statement = $pdoDbInstance->prepare($query);
$result = $statement->execute(array(":name" => $name, ":assignation" => $assignation, ":priority" => $priority));
有它們之間的任何差異顯著????
這並不是說IM認識的,但是使用循環時,第一種方法是好的 –
是的,這等後回答我的問題[PDO沒有裝訂](http://stackoverflow.com/questions/21110329/using-pdo-不結合) –