PDO: Positional and Named PlaceholdersTag: PHP Data Objects, PDO, extension, PHP extension, query, statement, positional placeholders, named placeholders Category: PHP Databasepost: 19 Apr 2008 read: 155 PHP Data Objects (PDO) Step By Step Tutorial - Part 8: We had known about prepare statement from previous post. Now, we talk more deep about placeholder. Positional Placeholders Give attention to this query:
The query above used question marks to designate the position of values in the prepared statement. These question marks are called positional placeholders. We must take care of proper order of the elements in the array that we are passing to the PDOStatement::execute() method. Named Placeholders Give attention to this query:
This use descriptive names preceded by a colon, instead of question marks. We don't care about position/order of value. That's why it called named placeholders. |
| | Give Your Opinion | Recommend |
|

