如何从mysql中检索带有数组id的数据

时间:2016-10-10 03:26:09

标签: php mysql

我正在从MySQL中检索用于编辑/更新数据的表单文本字段的数组数据,现在每个数据都有相同的Namename="es_outcall_price",例如文本字段es_outcall_price[] es_outcall_price[1] es_outcall_price[2] 和我我正在检索3次,所以我想它应该...

es_outcall_price

每个字段都应该是我自己的名字,如上所述,现在它显示所有3的<tbody> <? $query12 = "select * from escorts_rates_outcall where es_id='$es_id'"; $result12 = @mysql_query ($query12); while ($row12 = @mysql_fetch_array ($result12, MYSQL_ASSOC)) { $es_outcall_time = $row12['es_outcall_time']; $es_outcall_price=$row12['es_outcall_price']; ?> <tr> <td>1</td> <td> <select id="es_outcall_time" class="form-control" name="es_outcall_time"> <option value="$es_outcall_time"><?=$es_outcall_time?></option> <option value="null">- Select -</option> <option value="Half hour">Half hour</option> <option value="1 Hour">1 Hour</option> <option value="1.5 Hour">1.5 Hour</option> <option value="2 Hours">2 Hours</option> <option value="3 Hours">3 Hours</option> <option value="4 Hours">4 Hours</option> <option value="5 Hours">5 Hours</option> <option value="6 Hours">6 Hours</option> <option value="7 Hours">7 Hours</option> <option value="8 Hours">8 Hours</option> <option value="10 Hours">10 Hours</option> <option value="12 Hours">12 Hours</option> <option value="15 Hours">15 Hours</option> <option value="18 Hours">18 Hours</option> <option value="24 Hours">24 Hours</option> <option value="36 Hours">36 Hours</option> <option value="48 Hours">48 Hours</option> </select> </td> <td> <input id="es_outcall_price" name="es_outcall_price" placeholder="$ (AUD)" class="form-control" type="text" value="<?=$es_outcall_price?>"> </td> <td> <a href="#" title="" class="add-remove"><span class="fa fa-times-circle-o field-required"/></span></a> </td> </tr> <? } ?> </tbody> I am using this JS when i am inserting code after clicking "add more row" //Code for "Add More" OUTCALL text fields button var counterOutcall = 1; jQuery('a.add-outcall').click(function(event){ event.preventDefault(); counterOutcall++; var wrapper = jQuery("table.table-bordered.responsive-table.outcall"); //Fields wrapper var newRow = jQuery('<tr><td>' + counterOutcall + '</td><td><select id="es_outcall_time[]' + counterOutcall + '" class="form-control" name="es_outcall_time[]' + counterOutcall + '"><option value="null">- Select -</option><option value="Half hour">Half hour</option><option value="1 Hour">1 Hour</option><option value="1.5 Hour">1.5 Hour</option><option value="2 Hours">2 Hours</option><option value="3 Hours">3 Hours</option><option value="4 Hours">4 Hours</option><option value="5 Hours">5 Hours</option><option value="6 Hours">6 Hours</option><option value="7 Hours">7 Hours</option><option value="8 Hours">8 Hours</option><option value="10 Hours">10 Hours</option><option value="12 Hours">12 Hours</option><option value="15 Hours">15 Hours</option><option value="18 Hours">18 Hours</option><option value="24 Hours">24 Hours</option><option value="36 Hours">36 Hours</option><option value="48 Hours">48 Hours</option></select' + counterOutcall + '"/></td><td><input name="es_outcall_price[]" id="es_outcalll_price[]' + counterOutcall + '" placeholder="$ (AUD)" class="form-control" type="text"/></td><td><a href="#' + counterOutcall + '" title="" class="add-remove"><span class="fa fa-times-circle-o field-required"/></span></a></td></tr>'); jQuery(wrapper).append(newRow); jQuery(wrapper).on('click', '.add-remove', function(event){ event.preventDefault(); $(this).closest('tr').remove(); }) }); 。我希望你们所有人都能理解我的问题。

maximize sum(i in cargos, j in comps) profit[i]*x[i][j];

subject to {
cons01
    forall(i in cargos)
      available_wight:
        sum(j in comps) x[i][j] <= weight[i];

cons02:
    forall (j in comps)
      weight_capacity:
        sum(i in cargos)x[i][j] <= weight_cap[j];

cons03;
    forall (j in comps)
      space_capacity;
        sum(i in cargos)valume[i]*x[i][j] <= space_cap[j];

Database structure

after retrieving data from database

0 个答案:

没有答案