0
Guys, I’m trying to make a query with a variable that I’m receiving, but it’s not working. Any suggestions ?
$model = $_REQUEST['model'];
$customer = $_REQUEST['customer'];
SELECT * FROM sistema WHERE concluido <> 1 AND site='$site' AND $model='X'
0
Guys, I’m trying to make a query with a variable that I’m receiving, but it’s not working. Any suggestions ?
$model = $_REQUEST['model'];
$customer = $_REQUEST['customer'];
SELECT * FROM sistema WHERE concluido <> 1 AND site='$site' AND $model='X'
3
Elaborate as follows:
$model = $_REQUEST['model'];
$customer = $_REQUEST['customer'];
$consulta = "SELECT * FROM sistema WHERE concluido <> 1 AND site = '{$site}' AND {$model} = 'X'";
Do not forget to check if the variables are coming correctly and if really the comparison signal is <>, maybe you can use = '1'.
Sensational André, Thanks friend!!
Browser other questions tagged php mysql sql
You are not signed in. Login or sign up in order to post.
What is the error? And these variables are coming correctly?
– Sr. André Baill
You’re very confused about this. You’re not using $Ustomer, instead you’re using $site. I didn’t understand if the sql string is like this and if you don’t know how to query the database or if it was just an example...
– Jorge B.
Tried to print the query and run straight into the bank?
– rray
I hope that
$modelis not what it seems...– Papa Charlie