Php 未知列';客户';在';关于第'条;

Php 未知列';客户';在';关于第'条;,php,mysql,sql,Php,Mysql,Sql,我有一个发票脚本为我的公司,我现在有一点知识的PHP(特别是操纵现有的文件)和脚本的程序员不再是可用的,所以我决定扩展脚本与报价清单。这与invoice脚本的工作原理完全相同,只是它使用不同的表 现在我得到了一个错误: 发生数据库错误 错误号码:1054 “on子句”中的未知列“customer” 原始脚本(用于发票): 由我编写的脚本(用于报价): 我的脚本与原始脚本的区别在于表。 如何解决此错误 注意:这个错误当然不会出现在原始脚本中 提前谢谢 编辑: 各表: ---------------

我有一个发票脚本为我的公司,我现在有一点知识的PHP(特别是操纵现有的文件)和脚本的程序员不再是可用的,所以我决定扩展脚本与报价清单。这与invoice脚本的工作原理完全相同,只是它使用不同的表

现在我得到了一个错误:

发生数据库错误
错误号码:1054
“on子句”中的未知列“customer”

原始脚本(用于发票):

由我编写的脚本(用于报价):

我的脚本与原始脚本的区别在于表。 如何解决此错误

注意:这个错误当然不会出现在原始脚本中

提前谢谢

编辑: 各表:

-------------------------------
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
有问题了。 我刚刚意识到我在数据库中输入了一个错误。 我写的专栏名是:客户而不是客户


谢谢大家的帮助

正如错误所说,“customer”列不存在。您的表是什么样子的?如果表中不存在字段(此处为“customer”),则会发生此错误。您必须更改表以添加此字段。这不是一个PHP错误,但它与您的数据库结构有关
table1.column=table2.column
它就在这里:
在idcustomer=customer$where
中使用
customer
就像它是一个列,但它不是。。。它可能需要类似于
customer.idcustomer
,无论您需要加入哪个ID字段。您的
offerte
表可能没有
customer
列。检查您的模式并相应地更新查询。
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