Is it possible to put variable operators in queries?
I tried this (the real variable comes from a form)

$Date_Operator =(">=");

sql="SELECT * FROM poeple WHERE age $Date_operator 20";
$result_id = mysql_query($sql);

It doesn't work like this. I also tried:

sql="SELECT * FROM poeple WHERE age \"$Date_operator\" 20"
$result_id = mysql_query($sql);

it didn't work either.

Or should I use a have to make a IF-Then construction?

If $Date_Operator == (">=")
    sql="SELECT * FROM poeple WHERE age >= 20"

Can anybody help me with this?

Thanks in advance!
Met vriendelijke groet / With Greetings,

Sander Peters

   site: http://www.visionnet.nl/
  email: mailto:[EMAIL PROTECTED]
webmail: mailto:[EMAIL PROTECTED]

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to