phpcms v9 資料庫操作函數

來源:互聯網
上載者:User

標籤:blog   http   os   ar   資料   div   sp   log   html   

phpcms v9 資料庫操作函數

表明預設當前load_model(‘xxxx‘)模組所在表名xxxx

    若要指定表名  則:操作在mysql.class.php中$this->db->select(...)

1、查詢
  $this->select($where = ‘‘, $data = ‘*‘, $limit = ‘‘, $order = ‘‘, $group = ‘‘, $key=‘‘)   返回結果集數組
         條件 ,欄位(id,name,email....),範圍   排序方式,分組方式,按建名排序


2、查詢多條資料並分頁

    listinfo($where = ‘‘, $order = ‘‘, $page = 1, $pagesize = 20, $key=‘‘, $setpages = 10,$urlrule = ‘‘,$array = array())

3、擷取單條記錄查詢

      get_one($where = ‘‘, $data = ‘*‘, $order = ‘‘, $group = ‘‘)

4、直接執行sql查詢

    query($sql);

5、擷取最後一次添加記錄的主鍵號  insert_id()

6、執行更新記錄操作   update($data, $where = ‘‘)  $data 建議為數組,$where 可為數組可為字串

7、執行刪除記錄操作   delete($where)

8、計算記錄數         count($where = ‘‘)

9、擷取最後資料庫操作影響到的條數  affected_rows()

10、擷取資料表主鍵     get_primary()

11、擷取表欄位     get_fields($table_name = ‘‘)

12、檢查表是否存在   table_exists($table)

13、 檢查欄位是否存在  field_exists($field)

phpcms v9 資料庫操作函數

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.