刚接触Ecmall的二次开发不久,接到一个任务。很常见的任务,主要是对数据库进行一些操作,其中查询的方法我写成这样:

01 function get_order_data($goods_id)
02 {
03     include_once("gonndb/nmdb.php");
04     include_once("gonndb/dbinfo.php");
05      
06     $connector new nmdb($host$username$password);
07     $connector -> select_db($database);
08  
09     $sql = "select a.buyer_name, a.add_time, a.status, b.phone_tel, b.phone_mob, c.price, c.quantity
10             from shop_order a, shop_order_extm b, shop_order_goods c
11             where a.order_id = b.order_id and b.order_id = c.order_id
12             and c.goods_id = '".$goods_id."'
13             order by a.add_time desc
14             limit 3 ";
15              
16     $result $connector -> query($sql);
17      
18     //$r = array();
19     while($myrow $connector -> fetch_array($result))
20     {
21         $r[] = $myrow;
22     }
23      
24     return $r;
25 }

相关文章:

  • 2022-12-23
  • 2021-10-18
  • 2022-12-23
  • 2022-02-23
  • 2022-12-23
  • 2021-04-19
  • 2022-12-23
  • 2021-10-01
猜你喜欢
  • 2022-12-23
  • 2021-09-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-07
相关资源
相似解决方案