我在杂货店crud中使用set_relation_n_n时遇到问题
问题是mysql告诉我,检索数据的数据库有错误的MySQL 5.6.23语法的查询是我服务器的版本。并且不知道在哪里可以找到不允许我编辑系统中字段的解决方案
我把这两张桌子搞错了
TABLE
Docente_Escuela
(Id_afiliadoint(11)NOT NULL,
Id_escuelaint(11)NOT NULL,优先级
int(11)NOT NULL,
PRIMARY KEY(id_afiliado
,id_escuela
))ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_swedish_ci;
另一个
TABLE
Escuela
(Id_escuelaint(11)NOT NULL AUTO_INCREMENT,
Numerovarchar(10)NOT NULL utf8_spanish_ci COLLATE,
Name
varchar(200)NOT NULL utf8_spanish_ci COLLATE,
Domiciliovarchar (100)NOT NULL utf8_spanish_ci COLLATE,
Id_nivelint(11)NOT NOT NULL,Id_modalidad
int(11)NOT NULL,
Id_ciudadint(11)NOT NULL,
Cod_postalvarchar(30)NOT NULL utf8_spanish_ci COLLATE,
Telefonovarchar(50)NOT NULL utf8_spanish_ci COLLATE,
Celularvarchar(50)NOT NULL utf8_spanish_ci COLLATE,
邮件varchar(100) NOT NULL utf8_spanish_ci COLLATE,
Mail_altvarchar(100)NOT NULL utf8_spanish_ci COLLATE,
Mail_alt_2varchar(100)NOT NULL utf8_spanish_ci COLLATE,
Observacionesint(11)NOT NULL,
Clave_cobrovarchar(10)NOT NULL utf8_spanish_ci COLLATE,
Status
tinyint(1)NOT NULL DEFAULT'1'PRIMARY KEY (id_escuela
))ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_spanish_ci AUTO_INCREMENT = 2;
和表会员
TABLE
Afiliado
(Id_afiliadoint(11)NOT NULL AUTO_INCREMENT,
Name
varchar(100)NOT NULL utf8_spanish2_ci COLLATE,
Apellidovarchar(100)NOT NULL utf8_spanish2_ci COLLATE,
Documentovarchar(11)NOT NULL utf8_spanish2_ci COLLATE,
Domiciliovarchar (200)NOT NULL utf8_spanish2_ci COLLATE,
Id_situacionint(11)NOT NOT NULL,Id_localidad
int(11)NOT NULL,
Id_provinciaint(11) NOT NULL,
Cod_postalvarchar(30)NOT NULL utf8_spanish2_ci COLLATE,
Telefono_fijovarchar(30)NOT NULL utf8_spanish2_ci COLLATE,
Telefono_altvarchar(30)NOT NULL utf8_spanish2_ci COLLATE,
Celularvarchar(30)NOT NULL utf8_spanish2_ci COLLATE,
邮件varchar(100)NOT NULL utf8_spanish2_ci COLLATE,
Mail_altvarchar(100)NOT NULL utf8_spanish2_ci COLLATE,
Clave_cobrovarchar(20)NOT NULL utf8_spanish2_ci COLLATE,
Valor_cuotavarchar(20)NOT NULL utf8_spanish2_ci COLLATE,
Status
tinyint (1)NOT NULL DEFAULT'1'PRIMARY KEY(id_afiliado
))ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_spanish2_ci AUTO_INCREMENT = 6;
所以我打电话给系统
$ Crud-> set_relation_n_n('Schools','Docente_Escuela','学校', 'id_afiliado''id_escuela','name','priority');
这是错误
错误号码:1064
您的SQL语法有错误;检查手册 对应于您的MySQL服务器版本,以便使用正确的语法 靠近'WHERE``Escuela
.
id_escuelaid_afiliado
='5'ORDER BYDocente_Escuela
。第3行的'pri'SELECT * FROM
s7a675883 name as Docente_Escuela
EscuelaON LEFT JOIN
Docente_Escuela
。 Id_escuela =``WHERE
Escuela.
id_escuelaid_afiliado
='5'订购Docente_Escuela
。priority
文件名:models / Grocery_crud_model.php
行号:336
有人可以帮助我推进一下吗?我被锁了
谢谢!! 布鲁诺
答案 0 :(得分:1)
您的crud通话中存在语法错误。
在$crud->set_relation
和'id_afiliado'
之间检查'id_escuela'
中缺少的逗号。