Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将MySQL查询转换为CodeIgniter_Php_Mysql_Codeigniter - Fatal编程技术网

Php 如何将MySQL查询转换为CodeIgniter

Php 如何将MySQL查询转换为CodeIgniter,php,mysql,codeigniter,Php,Mysql,Codeigniter,我试图将此查询转换为CodeIgniter,但我只是一个初学者。我发现如何转换简单的SQL,但这段代码对我来说太难了。有没有人能帮我把这个代码转换成CodeIgniter SELECT cm.customerID,cm.customerName, cm.phone,adr.address, adr.city, adr.zipcode, bd.bookingDate,bd.startBooking, bd.endBooking, pt.type FROM c

我试图将此查询转换为CodeIgniter,但我只是一个初学者。我发现如何转换简单的SQL,但这段代码对我来说太难了。有没有人能帮我把这个代码转换成CodeIgniter

SELECT
    cm.customerID,cm.customerName, cm.phone,adr.address,
    adr.city, adr.zipcode,
    bd.bookingDate,bd.startBooking,
    bd.endBooking, pt.type
FROM
    customers cm, addresses adr, bookings bd, paymentTypes pt,customer_payment cp
WHERE
    cm.customerID=adr.customerID AND
    cm.customerID=bd.customerID AND
    pt.paymentID=cp.paymentID AND
    cm.customerID=cp.customerID
ORDER by
    bookingDate;

你可以用简单的方法


$this->db->querySELECT cm.customerID,cm.customerName,cm.phone,adr.address,adr.city,adr.zipcode,bd.bookingDate,bd.startBooking,bd.endBooking,pt.type FROM customers cm,addresses adr,bookings bd,paymentTypes pt,客户付款cp,其中cm.customerID=adr.customerID,cm.customerID=bd.customerID,pt.paymentID=cp.paymentID,cm.customerID=cp.customerID按预订日期订购

以其他方式连接查询

$this->db->选择cm.customerID、cm.customerName、cm.phone、adr.address、adr.city、dr.zipcode、bd.bookingDate、bd.startBooking、bd.endBooking、pt.type

$this->db->fromcm客户cm

$this->db->adr,adr.customerID=cm.customerID

$this->db->joinbookings bd,bd.customerID=cm.customerID

$this->db->joincustomer\u付款cp,cp.customerID=cm.customerID

$this->db->joinpaymentTypes pt,pt.paymentID=cp.paymentID


$this->db->order_bybd.bookingDate,asc

我为Marcin的语气道歉,评论已经向主持人报告了。然而,在发布问题之前,我们要求进行最低限度的研究。是否有一个教程可以用来了解如何在CodeIgniter中进行数据库调用?无论如何,这个查询应该不会太难。您的WHERE子句都是连接-手册中有没有一节将表连接在一起?对不起,我只是codeigniter的初学者。我没有任何教程请在您喜爱的搜索引擎中搜索CodeIgniter查询教程或CodeIgniter数据库示例。我希望手册也会很好——它是一个非常流行的框架。