I am trying to find out the best way to write a query and would appreciate any input that you may have.
All variables are defined in the submit form and are as follows...
$class = radio button selecting a desired subject. Each subject is listed in the DB as yes/no (its available or not)
$recip = yes/no
$html = yes/no
$console = yes/no
$thumbs = yes/no
In the DB --- recip, html, console and thumbs each have one of three values yes/no/dontcare
When a query is submitted and the actual value in the DB is "dontcare", I want it to show up in the results regardless if they selected yes or no.
This is what I wrote and I want to find out if it appears correct. Is there a better way that it could have been written?
$query = "SELECT * FROM tblSubmit Where $class='yes' AND recip='$recip' OR recip="dontcare" AND html='$html' OR html="dontcare" AND console='$console' OR console="dontcare" AND thumbs='$thumbs' OR thumbs="dontcare" "
I am very new and am trying to find the best way to write these things.
Cheers!