我们可以在CI中使用单个where子句来执行多个查询

时间:2016-11-16 10:07:29

标签: mysql codeigniter where-clause

    $this->db->where('product_id',$product_id);
    $this->db->where('seller_id',$loginSession[0]->seller_id);
    $res1=$this->db->delete('crm_seller_cart'); 

    //$this->db->where('product_id',$product_id);
    //$this->db->where('seller_id',$loginSession[0]->seller_id);
    $res2=$this->db->delete('crm_customer_recently_viewed');

此处$res1$res2都返回1但物理行不会删除$res,序列中是否有任何问题

1 个答案:

答案 0 :(得分:0)

试试这个

<script>
     $(function(){
        $("#datepicker" ).datepicker({
           changeMonth: true,
           changeYear: true,
           showAnim: 'clip',
           dateFormat: "yy-mm-dd" 
        }).val();
    });


    $("#datepicker").click(function() {
        if (confirm("If you change the Date the Fare fields data will be deleted !!")) {
            $('#fare').val('');
        } else {
            return false;
            $("#datepicker").datepicker('destroy');
        }
    });
<script>

OR

  $condition=array('product_id' => $product_id,'seller_id'=>$loginSession[0]->seller_id);

    $this->db->delete('crm_seller_cart', $condition);
    $this->db->delete('crm_customer_recently_viewed',$condition);