
In plain words
SQL injection happens when an app glues what a user typed directly into a SQL query. A specially crafted input can then change the query's meaning, for example to return every user instead of one.
Think of a form letter: "Give the parcel to ___." If someone writes "anyone who asks" in the blank, and the clerk follows the letter exactly, the rule is broken. The fix is to keep the blank separate from the instructions.
How to prevent it
Use parameters (bindings): the query and the input travel separately, so input can never become part of the command. Laravel's query builder and Eloquent do this automatically.
Practise the fix in Secure a Laravel app.

Every lesson stays free. Tap the thumbs up so we know what works, or say thanks with a soda or a coffee: it pays for hosting and new lessons.


