久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

getdata table表格數據join mysql方法的示例分析

147次閱讀
沒有評論

共計 4096 個字符,預計需要花費 11 分鐘才能閱讀完成。

這篇文章主要為大家展示了“getdata table 表格數據 join mysql 方法的示例分析”,內容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓丸趣 TV 小編帶領大家一起研究并學習一下“getdata table 表格數據 join mysql 方法的示例分析”這篇文章吧。

public function json_product_list($where, $order){
 global $_M;
 $this- table = load::sys_class( tabledata ,  new 
 $p = $_M[table][ product 
 $s = $_M[table][ shopv2_product 
 if($_M[ config][shopv2_open]){// 開啟在線訂購時
 $table = $p.  Left JOIN  .$s.  ON ({$p}.id = {$s}.pid) 
 $where =  {$p}.lang= {$_M[ lang]}  and ({$p}.recycle =  0  or {$p}.recycle =  -1 ) {$where} 
 }else{
 $table = $p;
 $where =  lang= {$_M[ lang]}  and (recycle =  0  or recycle =  -1) {$where} 
 }
 $data = $this- table- getdata($table,  * , $where, $order);
 foreach($data as $key= $val){ if(!$val[ pid])$data[$key][pid] = $val[ id 
 }
 return $data;
 }

例子一:

 $u = $_M[table][user
           $o = $_M[table][shopv2_order
           $d = $u. Left JOIN .$o. ON {$u}.id = {$o}.uid

 function dotable_course_user_list_json(){
 global $_M;
 $id=$_M[form][ id // 教師模塊 ID
 $tid=$_M[form][ tid // 教師登錄用戶 ID
 $tn=$_M[form][ tn // 教師用戶名
 $term1 = $_M[form][ search_title  // 獲取搜索關鍵詞
 $search2 = $term1 ? and username like  %{$term1}%   : // 增加查詢報名表編號
 $table = load::sys_class( tabledata ,  new 
 //$where =  lang= cn  {$search} {$search2}  // 在條件語句中加入查詢條件  $search
 $u = $_M[table][ user 
 $o = $_M[table][ shopv2_order 
 $d = $u.  Left JOIN  .$o.  ON {$u}.id = {$o}.uid 
 //$table = $u.  Left JOIN  .$a.  ON (find_in_set(u.id,a.user_id) != 0) 
 $where =  {$u}.lang= {$_M[ lang]} 
 $order =  {$u}.id DESC 
 $array = $table- getdata($d,  * , $where, $order);
 //$data = $this- table- getdata($table,  * , $where, $order)
 //$time=date(Y-m-d H:i:s ,time());
 foreach($array as $key =  $val){
 // 會員組
 $rs_user_group=DB::get_one(SELECT id,name FROM  .$_M[ table][user_group].  where id= $val[groupid]   
 // 狀態
 // 班型
 //$rs1=DB::get_all(SELECT s.class_id,a.user_id,a.id,a.number,cc.classhour FROM  .$_M[ table][my_application].  as a INNER JOIN  .$_M[table][my_application_subject].  as s ON a.number=s.number INNER JOIN  .$_M[table][my_class].  as c ON s.class_id=c.id INNER JOIN  .$_M[table][my_class_course].  as cc ON cc.class_id=c.id where s.class_id 0 and s.type_11=0 and c.teachers_id= $val[id]  and cc.endtime $time 
 $list = array();
 $list[] =  {$val[ username]} 
 $list[] =  {$rs_user_group[ name]} 
 $list[] =  
 $list[] =  
 $list[] =  
 $list[] =  
 $list[] =  
 $list[] =  
 $list[] =  
 $list[] =  a  >

例子二:join find_in_set

 $u = $_M[table][user
           $a = $_M[table][my_application
           $d = $u. Left JOIN .$a. ON find_in_set({$u}.id,{$a}.user_id) != 0

 function dotable_course_user_list_json(){
 global $_M;
 $id=$_M[form][ id // 教師模塊 ID
 $tid=$_M[form][ tid // 教師登錄用戶 ID
 $tn=$_M[form][ tn // 教師用戶名
 $term1 = $_M[form][ search_title  // 獲取搜索關鍵詞
 $search2 = $term1 ? and username like  %{$term1}%   : // 增加查詢報名表編號
 $table = load::sys_class( tabledata ,  new 
 //$where =  lang= cn  {$search} {$search2}  // 在條件語句中加入查詢條件  $search
 $u = $_M[table][ user 
 //$o = $_M[table][ shopv2_order 
 $a = $_M[table][ my_application 
 //$d = $u.  Left JOIN  .$o.  ON {$u}.id = {$o}.uid 
 $d = $u.  Left JOIN  .$a.  ON find_in_set({$u}.id,{$a}.user_id) != 0 
 $where =  {$u}.lang= {$_M[ lang]} 
 $order =  {$u}.id DESC 
 $array = $table- getdata($d,  * , $where, $order);
 //$data = $this- table- getdata($table,  * , $where, $order)
 //$time=date(Y-m-d H:i:s ,time());
 foreach($array as $key =  $val){
 // 會員組
 $rs_user_group=DB::get_one(SELECT id,name FROM  .$_M[ table][user_group].  where id= $val[groupid]   
 // 狀態
 // 班型
 //$rs1=DB::get_all(SELECT s.class_id,a.user_id,a.id,a.number,cc.classhour FROM  .$_M[ table][my_application].  as a INNER JOIN  .$_M[table][my_application_subject].  as s ON a.number=s.number INNER JOIN  .$_M[table][my_class].  as c ON s.class_id=c.id INNER JOIN  .$_M[table][my_class_course].  as cc ON cc.class_id=c.id where s.class_id 0 and s.type_11=0 and c.teachers_id= $val[id]  and cc.endtime $time 
 $list = array();
 $list[] =  {$val[ username]} 
 $list[] =  {$rs_user_group[ name]} 
 $list[] =  
 $list[] =  
 $list[] =  
 $list[] =  
 $list[] =  
 $list[] =  
 $list[] =  
 $list[] =  a  >

注意:

1、列出全部數據

$data = $this- table- getdata($table,  * , $where, $order)

2、只列出指定字段數據

$array = $table- getdata($d,  {$u}.username,{$u}.groupid , $where, $order);

3、模糊查詢

$where =  {$u}.lang= {$_M[ lang]}  and {$u}.username like  %{$term1}%  

以上是“getdata table 表格數據 join mysql 方法的示例分析”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注丸趣 TV 行業資訊頻道!

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-08-04發表,共計4096字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 武宣县| 宁明县| 富裕县| 东阳市| 马龙县| 平泉县| 溧阳市| 科技| 德钦县| 方山县| 普兰店市| 长垣县| 诸城市| 彭泽县| 曲阳县| 巴南区| 柳河县| 大足县| 谷城县| 漯河市| 滨州市| 拉萨市| 河北省| 平邑县| 绥江县| 龙井市| 道孚县| 南康市| 祁连县| 平安县| 太仓市| 疏附县| 洛宁县| 宁晋县| 巍山| 垣曲县| 二连浩特市| 蒲江县| 肇源县| 宁城县| 星子县|