清空数据库中所有表--连表删除

public function trun(){
  $sql = "show tables";
  $info = M()->query($sql);
  // echo '<meta http-equiv="Content-type" content="text/html:charset=utf-8">';
  // echo '<pre>';
  // var_dump($info);

foreach($info as $k=>$v){

    $sql = "truncate table ".$v['tables_in_tripb'];
    $num = M()->execute($sql);
    var_dump($num);

}

}

 

 

=========连表删除

delete t_apply

from t_apply , t_applyitems

where t_apply.apply_applicant_id = t_applyitems.applyitem_applyid

and t_apply.apply_applicant_id = 363;

 

posted @ 2016-07-12 10:20  小庄啊  阅读(181)  评论(0编辑  收藏  举报