简体   繁体   中英

Php phalcon join query doesn't return anything

I am trying to run a query in phalcon php

$c_inv = ClientInvoices::query()->columns(['supplier_invoice_number', ' client_payment_req_id',
            'net_amount','markup_value','markup_type','net_qty'])
              // ->innerjoin("Invoices\Model\ClientPaymentRequests", "Invoices\Model\ClientInvoices.client_payment_req_id=CPR.id", "CPR")
             ->innerJoin("Contract\Model\ContractAdditionalInfoModel", "CAI.contract_id=Invoices\Model\ClientInvoices.contract_id", "CAI")
               // ->innerjoin("Contract\Model\Contract", "Contract\Model\ContractAdditionalInfoModel.buyer_contract_id=CO.id", "CO")
            ->where("Invoices\Model\ClientInvoices.client_payment_req_id=$id")->andWhere('Invoices\Model\ClientInvoices.status=3')->execute()->toArray();

When I do

print_r($c_inv)  or var_dump($c_inv)

Nothing shows on screen,same query works on phpmyadmin,how to figure out what's wrong with the query?. Help me out please

Try to replace ->execute()->toArray() with ->getQuery()->getSql() and run the SQL code in PhpMyAdmin to see if it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM