动态拼接sql语句,实现高级条件查询功能
1.前端html,建一个表格,给定tbody一个id,当点击一个添加按钮的时候,动态的加一行表格:
<table class="table table-bordered" id="tab">
<thead>
<tr>
<th>#</th>
<th><label>关系</label></th>
<th><label>括号</label></th>
<th><label>字段名</label></th>
<th><label>运算符</label></th>
<th><label>值</label></th>
<th><label>括号</label></th>
</tr>
</thead>
<tbody id="tb_sql_list">
<tr>
<th scope="row">1</th>
<td>
<div class="form-group col-sm-1">
<select name="column_relative" id="column_relative" class="form-control input-sm" disabled >
<option></option>
<option value="or">or</option>
<option value="and">and</option>
</select>
</div>
</td>
<td>
<div class="form-group col-sm-1">
<select name="brackets_pre" id="brackets_pre" cl