I have PHP / SQL query like this:
return $this->db->query("SELECT * FROM candidates WHERE firstname = ".$searchParams->firstname." AND surname = ".$searchParams->firstname."");
and getting error:
Column not found: 1054 Unknown column 'Dante' in 'where clause
However column Dante is not in query ( it is user input in $searchParams->firstname
I read on google that SQL read things revert, so from right to left, and problem should be in apostroph or quotation marks. I try to replace a lot things but can't find the right way how to fix this.
Can someone advise me what I'm doing wrong?