Hi all !
I wish to build a mysql query which is very simple. An example of the query I want is as follows:
$query = "Select * FROM $table WHERE tables=1 OR tables=2 AND Member_status = 'D' ";
The problem is that the conditions Where tables=1 or tables=2 can vary and i can have tables=3 , tables=4 etc. as well. So basically the OR condition is ramdom and must be constructed in a loop.
I constructed a loop which stores the result in a variable $tablescnt. i.e.
echo .$tablescnt; gives tables=1 OR tables=2 OR tables=3 and so on depending upon the loop iterations.
However i don't know i am going to substitute this ($tablescnt) into $query above.
I tried
$query = "Select * FROM $table WHERE '$tablescnt' AND Member_status = 'D' ";
where i hoped that $tablescnt would expand as desired. However it did not work. So any suggestions on how I may proceed would be very helpful.
Thanks all for your time to check this out and help me.