私は自分の会社の請求書スクリプトを持っていますが、現在は PHP の知識がほとんどなく (特に既存のファイルの操作)、スクリプトのプログラマーは利用できなくなっているため、オファー リストを使用してスクリプトを拡張することにしました。これは請求書スクリプトとまったく同じように機能しますが、異なるテーブルを使用するだけです。
今、私はエラーが発生しています:
データベース エラーが発生しました
エラー番号: 1054
不明な列 '顧客' が 'on 句' にあります
SELECT idofferte,noofferte,CONCAT(namecustomer,' ',lastname)
customer,DATE_FORMAT(dateofferte,'%d/%m/%Y')dateofferte,
(SELECT SUM(pu*duration)
FROM service2
WHERE offerte=idofferte
) subtotal,discount,btw,transport,material
FROM offerte
INNER JOIN customer ON idcustomer=customer
WHERE 1=1
ORDER BY CAST(SUBSTR(noofferte,9) AS UNSIGNED) DESC
LIMIT 0,25
元のスクリプト (請求書用):
function ilist( $start = 0, $limit = 25, $pattern = '' ) {
$where = 'WHERE 1=1';
if( '' != $pattern )
$where .= " AND namecustomer LIKE '$pattern%' OR lastname LIKE '$pattern%'";
return $this->db->query( "SELECT idinvoice,noinvoice,CONCAT(namecustomer,' ',lastname) customer,DATE_FORMAT(dateinvoice,'%d/%m/%Y')dateinvoice,(SELECT SUM(pu*duration) FROM service WHERE invoice=idinvoice)subtotal,discount,btw,transport,material FROM invoice INNER JOIN customer ON idcustomer=customer $where ORDER BY CAST(SUBSTR(noinvoice,9) AS UNSIGNED) DESC LIMIT $start,$limit" )->result_array();
}
私によるスクリプト(オファー用):
function ilist( $start = 0, $limit = 25, $pattern = '' ) {
$where = 'WHERE 1=1';
if( '' != $pattern )
$where .= " AND namecustomer LIKE '$pattern%' OR lastname LIKE '$pattern%'";
return $this->db->query( "SELECT idofferte,noofferte,CONCAT(namecustomer,' ',lastname) customer,DATE_FORMAT(dateofferte,'%d/%m/%Y')dateofferte,(SELECT SUM(pu*duration) FROM service2 WHERE offerte=idofferte)subtotal,discount,btw,transport,material FROM offerte INNER JOIN customer ON idcustomer=customer $where ORDER BY CAST(SUBSTR(noofferte,9) AS UNSIGNED) DESC LIMIT $start,$limit" )->result_array();
}
私のスクリプトとオリジナルの違いはテーブルです。このエラーを解決するにはどうすればよいですか?
注: もちろん、エラーは元のスクリプトには表示されません。
前もって感謝します!
編集: テーブル:
-------------------------------
Invoice
-------------------------------
idinvoice
noinvoice
costumer
dateinvoice
discount
btw
transport
material
employee
creation
-------------------------------
Offerte
-------------------------------
idofferte
noofferte
customer
dateofferte
subjectofferte
discount
btw
transport
material
employee
creation
-------------------------------
customer
-------------------------------
idcustomer
namecustomer
lastname
address
number
zip
city
phone
email
-------------------------------
service
-------------------------------
idservice
dateservice
description
duration
pu
invoice
-------------------------------
service2
-------------------------------
idservice
dateservice
description
duration
pu
offerte