Just a curiosity question. Why phpMyadmin adds WHERE 1 to every statement in the SQL query input box?
For example,
SELECT * FROM User WHERE 1
When generating dynamic queries, it's easier to always have a WHERE clause than to have an algorithm to remove it when it's not needed. All that WHERE 1 means is 'everything' and phpMyAdmin will not append it if you put a WHERE clause in your own query.
phpMyAdmin probably creates its queries by concatenating strings, so it'll generate say $selectStatement, $whereStatement and $limitStatement and then add them all together. I don't know if it still does it, but it always used to add a LIMIT clause even when not needed as well.
It's just a simple and comprehensive way to build an SQL statement in PHP, and won't affect your query results at all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With