Because when using single quote, variables will not be expanded.
So your query practically looks like:
SELECT * FROM damage_log where damage=$parts
Thus an error occurs, and $stmt
is FALSE
.
Use double quote may fix your problem.
Also, since you're not quoting $parts
in your SQL statement, make sure $parts
is always a number or any other types that do not need quoting.