Skip to content
Advertisement

ERREUR : Unknown column ‘Accessoires’ in ‘where clause’

My query is throwing up this error while i have column Accessoires in table categorie Can anyone see why?

I FIXED IT LIKE THIS:

Advertisement

Answer

Using bound parameters with a prepared statement likely fixes your bug and also solves the severe security issue.

The likely reason your code has failed is that test was “Accessoires”, so the resulting SQL statement was:

when in fact it should have been:

Even if you added quotes to the concatenated statement, you’d still have a problem. Just imagine what happens if somebody passes a value with quotes, e.g. O'Connor. This will just break the code. But a more clever person can inject SQL clauses.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement