Query Execution
Posted: Thu Dec 18, 2003 3:35 am
Hello,
I am getting four input from the user and based on this I am building the query. (Total 16 conditions since 4 input, 2 to the power 4)
I have used "&&" and "||" operator, it was not working, hence I have used "and" and "or" operator. Still I am getting the same answer.
my first five condition goes like this
when i am giving two input or three input it checks for the first part and it executes that part only. it is not coming for the second part (it checks for $RNO!=="" and executes that part even other parameters also satisfies the condition).
Please point out where I am going wrong.
Thanks in advance,
S.Arul
[Edit: Added PHP tags for eyecandy. --JAM]
I am getting four input from the user and based on this I am building the query. (Total 16 conditions since 4 input, 2 to the power 4)
I have used "&&" and "||" operator, it was not working, hence I have used "and" and "or" operator. Still I am getting the same answer.
my first five condition goes like this
Code: Select all
if(($RNO=="") and ($CNAME=="") and ($DOB=="") and ($FATHER==""))
{
echo "<p align ="center">Select the search criteria correctly.</p>";
}
elseif(($RNO!="") and (($CNAME=="") or ($DOB=="") or ($FATHER=="")))
{
$Query = "SELECT RNO as RegNo,DOB as BirthDate,NAME as ChildName ,F_NAME as FatherName,M_NAME as MotherName FROM $council WHERE RNO='$RNO'";
}
elseif(($CNAME!="") and (($RNO=="") or ($DOB=="") or ($FATHER=="")))
{
$Query = "SELECT RNO as RegNo,DOB as BirthDate,NAME as ChildName ,F_NAME as FatherName,M_NAME as MotherName FROM $council WHERE NAME like '%$CNAME%' ORDER BY DOB";
}
elseif(($DOB!="") and (($CNAME=="") or ($RNO=="") or ($FATHER=="")))
{
$Query = "SELECT RNO as RegNo,DOB as BirthDate,NAME as ChildName ,F_NAME as FatherName,M_NAME as MotherName FROM $council WHERE DOB='$DOB' ORDER BY RDATE";
}Please point out where I am going wrong.
Thanks in advance,
S.Arul
[Edit: Added PHP tags for eyecandy. --JAM]