I have a variable that changes its content according to some user actions!
I want to use this same variable inside a select, as follows!
" Select * FROM tabele WHERE '$variável' "
However, when I apply variável
to Select
it displays the following error:
Fatal error: Call to a member function fetchAll() on boolean
As stated above the contents of this variable is dynamic, its contents can be:
$variavel = "Item1 = 'Dado'";
or:
$variavel ="Item1 = 'Dado' AND Item2 = 'Dado'";
Varies according to user action. However, if I add the contents of the variable in WHERE
directly, it works perfectly. Ex:
" Select * FROM tabele WHERE Item1 = 'Dado' AND Item2 = 'Dado'"
My question is:
How do I apply the contents of the variable within select without error? Apparently there have to be single and double quotation marks, but I've already made some changes here and nothing worked!