Gallery: Seeing SQL Injection in Pictures

SQL injection makes much more sense once you can *see* how user text slips into a query. This gallery gathers the visual explainers on this site, each with a caption describing what it shows.

The glued string

Picture: a SQL sentence with a gap, and a user's text sliding into the gap. When the text contains a quote mark, it "closes" the sentence early and adds its own instructions.

Where to see it: Breaking and Fixing a Tiny Login Form

Caption: this is the core idea of SQL injection. Once you see the quote mark breaking out, the rest follows.

Two envelopes

Picture: the SQL travels in one envelope, the user's value in another. The database opens the SQL envelope as instructions and the value envelope only as data.

Where to see it: How to Use Placeholders in Node.js to Stop SQL Injection

Caption: this is what placeholders do. The value can contain any characters at all; it is never read as SQL.

The five-way comparison

Picture: a table with five approaches and a tick or a warning sign next to each.

Where to see it: Side-by-Side: Five Ways People Try to Stop SQL Injection

Caption: shows at a glance which defences you can rely on and which are fragile.

The input map

Picture: a sketch of an app with arrows from every form, URL and upload pointing into the database.

Where to see it: A Printable Planner for Making a Small App Injection-Proof

Caption: every arrow is an input that must reach the database through a placeholder.

The slide outline

Picture: twelve slides, from "what is a query?" to "check every input".

Where to see it: SQL Injection in 12 Slides

Caption: useful if you are explaining injection to a classmate or study group.

The story version

Picture: a student's guestbook page, before and after a fix.

Where to see it: A Worked Scenario: SQL Injection in a Student Guestbook

Caption: an illustrative story that walks through how the problem is found and fixed.

Suggested order

  1. The glued string, to understand the problem.
  2. Two envelopes, to understand the fix.
  3. The input map, to apply the fix to your own app.
  4. The five-way comparison, to avoid weaker advice.

A note on practising

Only ever try injection examples on your own practice app and database. Testing other people's websites without permission is not acceptable and can be illegal. The well-known OWASP project publishes guidance for developers who want to learn more about web security responsibly.

A free learning page for beginners. Practise on a test database, never on real customer data, and check the official documentation for your database version.