Boolean/Logic searches

wxdqz

New Member
Ello,

I am trying to implement a search on specific library materials, I have given a web page (request and design by the librarians) where user simply enter a word or phrase in the find input fields (max of four) and they have a selection of searchable fields as Title, keywords, author.
Full Boolean/Logic searches are also needed the AND, OR, and NOT operators.

I have attempt many SQL statements using the post method.
I wanting to know what is the best strategy/ways accomplish this?
Should I query each find with its logic?
I also like to know how would I optimise those queries in the database end.
I have dumped the HTML code of the web page for anyone who does not understand what I am trying to get across.

Any common or suggestions are welcome.
I am using MySQL Server version 3.23.22 and php-3.0.12-6.

annalise

---the html code---


<CENTER>
<FORM METHOD ="post" ACTION ="blar.php3">
<TABLE BORDER ="0">
<TR><TH ALIGN ="CENTER" COLSPAN ="3"><B CLASS=typeC>Search</B></TH></TR>
<TR><TH ALIGN ="LEFT">&nbsp</TH><TD><B>Find :</B></TD>&nbsp;&nbsp;&nbsp;<TD><B>Field:</B></TD></TR>
<TR><TD>&nbsp</TD><TD><INPUT TYPE=TEXT NAME="find1" MAXLENGHT ="40" SIZE ="35"></INPUT>&nbsp;&nbsp;IN&nbsp;&nbsp;</TD>
<TD><SELECT NAME ='fieldpick1'>
<OPTION SELECTED VALUE =http://www.phpbuilder.com/board/archive/index.php/"all">&nbsp;All Fields</OPTION>
<OPTION VALUE ="keywords">&nbsp;Keyword(s)</OPTION>
<OPTION VALUE ="Author">&nbsp;Author</OPTION>
<OPTION VALUE ="Title">&nbsp;Title</OPTION>
</SELECT>
</TD>
</TR>
<TR><TD><SELECT NAME ='logic1'>
<OPTION SELECTED VALUE =http://www.phpbuilder.com/board/archive/index.php/"AND">&nbsp;AND</OPTION>
<OPTION VALUE ="OR">&nbsp;OR</OPTION>
<OPTION VALUE ="<>">&nbsp;NOT</OPTION>
</SELECT>
</TD>
<TD><INPUT TYPE=TEXT NAME="find2" MAXLENGHT ="40" SIZE ="35"></INPUT>&nbsp;&nbsp;IN&nbsp;&nbsp;</TD>
<TD><SELECT NAME ='fieldpick2'>
<OPTION SELECTED VALUE =http://www.phpbuilder.com/board/archive/index.php/"all">&nbsp;All Fields</OPTION>
<OPTION VALUE ="keywords">&nbsp;Keyword(s)</OPTION>
<OPTION VALUE ="Author">&nbsp;Author</OPTION>
<OPTION VALUE ="Title">&nbsp;Title</OPTION>
</SELECT>
</TD>
</TR>
<TR><TD><SELECT NAME ='logic2'>
<OPTION SELECTED VALUE =http://www.phpbuilder.com/board/archive/index.php/"AND">&nbsp;AND</OPTION>
<OPTION VALUE ="OR">&nbsp;OR</OPTION>
<OPTION VALUE ="<>">&nbsp;NOT</OPTION>
</SELECT>
</TD>
<TD><INPUT TYPE=TEXT NAME="find3" MAXLENGHT ="40" SIZE ="35"></INPUT>&nbsp;&nbsp;IN&nbsp;&nbsp;</TD>
<TD><SELECT NAME ='fieldpick3'>
<OPTION SELECTED VALUE =http://www.phpbuilder.com/board/archive/index.php/"all">&nbsp;All Fields</OPTION>
<OPTION VALUE ="keywords">&nbsp;Keyword(s)</OPTION>
<OPTION VALUE ="Author">&nbsp;Author</OPTION>
<OPTION VALUE ="Title">&nbsp;Title</OPTION>
</SELECT>
</TD>
</TR>
<TR><TD><SELECT NAME ='logic3'>
<OPTION SELECTED VALUE =http://www.phpbuilder.com/board/archive/index.php/"AND">&nbsp;AND</OPTION>
<OPTION VALUE ="OR">&nbsp;OR</OPTION>
<OPTION VALUE ="<>">&nbsp;NOT</OPTION>
</SELECT>
</TD>
<TD><INPUT TYPE=TEXT NAME="find4" MAXLENGHT ="40" SIZE ="35"></INPUT>&nbsp;&nbsp;IN&nbsp;&nbsp;</TD>
<TD><SELECT NAME ='fieldpick4'>
<OPTION SELECTED VALUE =http://www.phpbuilder.com/board/archive/index.php/"all">&nbsp;All Fields</OPTION>
<OPTION VALUE ="keywords">&nbsp;Keyword(s)</OPTION>
<OPTION VALUE ="Author">&nbsp;Author</OPTION>
<OPTION VALUE ="Title">&nbsp;Title</OPTION>
</SELECT>
</TD>
</TR>
<TR></TR>
</TABLE><BR><INPUT TYPE="submit" VALUE="Start Search"></INPUT>&nbsp;&nbsp;
<INPUT TYPE="reset" VALUE="Clear Search Details"></INPUT>&nbsp;&nbsp;
<INPUT TYPE="button" VALUE="Back" onclick="history.back()"></INPUT>
</FORM>
</CENTER>
 
Back
Top