I'm trying to build a query in a script that relies upon an object's attributes in order to retrieve the correct information. What I have is this:
$query = "SELECT fields FROM table WHERE fieldA = $this->x";
//Processing of results here
I've seen queries like this used before with string variables but I'm not sure if the rules are different if you're using a variable that you know has a numerical value and the corresponding column for said value is declared as an integer or decimal. Would I need to include single quotes around $this->x
?