I have a webpage from which I am selecting some values to construct my sql query in my cgi script.
For exanple, the webpage has the following content as its page source ,
<option value='notlike'>not like </option
<input type=text name='VALUE1' maxlength=40 size=30 value=''></td>
<td ><select name='CLOSEBRACK1'>
<td colspan=7 align=center>
<input type='hidden' name='NoOfRows' value="1" />
<input type="button" value="Add Condition" onclick="addRowToTable();"
By the "Add condition" button , I add a similar line of
table data in the webpage. And assume that, I collect all these param infos in my cgi script as,
$br1 = $cgi->param('OPENBRACK1');
$field1 = $cgi->param('FIELD1');
$value1 = $cgi->param('VALUE1');
$comp1 = $cgi->param('COMP1');
$br2 = $cgi->param('OPENBRACK2');
$field2 = $cgi->param('FIELD2');
$value2 = $cgi->param('VALUE2');
$comp2 = $cgi->param('COMP2');
So, upon submitting all these in a form, assume that I have all these infos in my cgi script. Now from these param infos how can I contruct a query like this :
select NAME,CITY from MyTable where NAME like %xyz% and
CITY not like %abc%;
Please help me with the logic or if there is any other built-in mechanism in cgi perl (some function or ENV variables) which will help me construct such a query.
The diffculty I am facing is how many 'AND' or 'OR' conditions have been used by 'Add condition' button or so.Hope I could explain my problem clearly.