From the course: Learning phpMyAdmin
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Using named parameters in a query
- A new feature in phpMyAdmin 4.5 allows you to use named parameters in the SQL tab. This can be very useful for testing PDO prepared statements because it uses the same syntax. I've opened the SQL tab in the cars table of the up_and_running database in phpMyAdmin 4.5. Let's run a simple query to select cars where the price is less than or equal to a particular value. So, we have to delete that WHERE 1, and then we'll make it WHERE 'price' then it will be <= but instead of putting in an actual value, I'm going to use a named parameter. Named parameters begin with a colon. You can call them what you like but I use the name of the column, price. Then we'll have an ORDER by clause and we'll use price as what we're ordering it by. Now, in the version of phpMyAdmin that I'm using, the query pane displays this cross in a red circle in the gutter and if we hover over it, it says there's an unexpected character near the colon. Now this obviously is not correct SQL but it does work. But to get…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
Performing a simple search8m 28s
-
Using query by example (QBE) to perform a simple search6m 6s
-
Finding and replacing text in a column3m 36s
-
Using QBE to set multiple conditions in a WHERE clause8m 2s
-
Joining multiple tables with QBE5m 2s
-
Building queries manually on a single table6m 48s
-
Building a query manually on multiple tables4m 3s
-
Saving frequently used queries with bookmarks7m 26s
-
Using a variable with a bookmarked query5m 37s
-
Using variables with bookmarks in phpMyAdmin 4.57m 19s
-
Using named parameters in a query4m 53s
-
Running queries from the console6m 31s
-
New Console options in phpMyAdmin 4.52m 17s
-
-
-
-