教义语法错误;/

发布于 2024-11-18 03:14:08 字数 2283 浏览 0 评论 0原文

我需要有关此代码的帮助:

$mdl = Doctrine_Query::create()
                ->update('Model_CoachsTownsLang ctl')
                ->set('ctl.Coachs_Users_id', '1')
                ->set('ctl.Towns_idTowns', '1')
                ->set('ctl.Langs_idLang', '2')
                ->set('ctl.title', $data['title'])
                ->set('ctl.active', $data['active'])
                ->set('ctl.description', $data['description'])
                ->set('ctl.modyfication', '1')
                ->set('ctl.modyfied_id', $userData['id'])
                ->set('ctl.permit', $data['permit'])
                ->where('ctl.Coachs_Users_id =?', $data['id'])
                ->execute();

ZFDebug 输出错误:

Doctrine_Connection_Mysql_Exception:SQLSTATE[42000]:语法错误或访问冲突:1064 您的 SQL 语法有错误;检查与您的MySQL服务器版本相对应的手册,以获取使用near'sdfg sdfg,active = 1,description = ...的正确语法,

但我查看了这段代码,没有发现语法错误。我指望你的帮助。

Tabla 向数据库添加结构:

CREATE  TABLE IF NOT EXISTS `intelektualnie`.`CoachsTownsLangs` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `Coachs_Users_id` INT NULL ,
  `Towns_idTowns` INT NULL DEFAULT NULL ,
  `Langs_idLang` INT NULL DEFAULT NULL ,
  `title` TEXT NULL DEFAULT NULL ,
  `description` TEXT NULL DEFAULT NULL ,
  `active` TINYINT(1) NOT NULL DEFAULT 0 ,
  `modyfication` TINYINT(1) NOT NULL DEFAULT 0 ,
  `modyfied_id` INT NULL DEFAULT NULL ,
  `permit` TINYINT(1) NOT NULL DEFAULT 1 ,
  PRIMARY KEY (`id`) ,
  INDEX `fk_CoachsTownsLangs_Coachs1` (`Coachs_Users_id` ASC) ,
  INDEX `fk_CoachsTownsLangs_Towns1` (`Towns_idTowns` ASC) ,
  INDEX `fk_CoachsTownsLangs_Langs1` (`Langs_idLang` ASC) ,
  CONSTRAINT `fk_CoachsTownsLangs_Coachs1`
    FOREIGN KEY (`Coachs_Users_id` )
    REFERENCES `intelektualnie`.`Coachs` (`Users_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_CoachsTownsLangs_Towns1`
    FOREIGN KEY (`Towns_idTowns` )
    REFERENCES `intelektualnie`.`Towns` (`idTowns` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_CoachsTownsLangs_Langs1`
    FOREIGN KEY (`Langs_idLang` )
    REFERENCES `intelektualnie`.`Langs` (`idLang` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8

I need help with this code:

$mdl = Doctrine_Query::create()
                ->update('Model_CoachsTownsLang ctl')
                ->set('ctl.Coachs_Users_id', '1')
                ->set('ctl.Towns_idTowns', '1')
                ->set('ctl.Langs_idLang', '2')
                ->set('ctl.title', $data['title'])
                ->set('ctl.active', $data['active'])
                ->set('ctl.description', $data['description'])
                ->set('ctl.modyfication', '1')
                ->set('ctl.modyfied_id', $userData['id'])
                ->set('ctl.permit', $data['permit'])
                ->where('ctl.Coachs_Users_id =?', $data['id'])
                ->execute();

ZFDebug output error:

Doctrine_Connection_Mysql_Exception: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sdfg sdfg , active = 1, description =...

But I look at this code and I see no errors in syntax. I am counting on your help.

Tabla adds structure to the database:

CREATE  TABLE IF NOT EXISTS `intelektualnie`.`CoachsTownsLangs` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `Coachs_Users_id` INT NULL ,
  `Towns_idTowns` INT NULL DEFAULT NULL ,
  `Langs_idLang` INT NULL DEFAULT NULL ,
  `title` TEXT NULL DEFAULT NULL ,
  `description` TEXT NULL DEFAULT NULL ,
  `active` TINYINT(1) NOT NULL DEFAULT 0 ,
  `modyfication` TINYINT(1) NOT NULL DEFAULT 0 ,
  `modyfied_id` INT NULL DEFAULT NULL ,
  `permit` TINYINT(1) NOT NULL DEFAULT 1 ,
  PRIMARY KEY (`id`) ,
  INDEX `fk_CoachsTownsLangs_Coachs1` (`Coachs_Users_id` ASC) ,
  INDEX `fk_CoachsTownsLangs_Towns1` (`Towns_idTowns` ASC) ,
  INDEX `fk_CoachsTownsLangs_Langs1` (`Langs_idLang` ASC) ,
  CONSTRAINT `fk_CoachsTownsLangs_Coachs1`
    FOREIGN KEY (`Coachs_Users_id` )
    REFERENCES `intelektualnie`.`Coachs` (`Users_id` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_CoachsTownsLangs_Towns1`
    FOREIGN KEY (`Towns_idTowns` )
    REFERENCES `intelektualnie`.`Towns` (`idTowns` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_CoachsTownsLangs_Langs1`
    FOREIGN KEY (`Langs_idLang` )
    REFERENCES `intelektualnie`.`Langs` (`idLang` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

素罗衫 2024-11-25 03:14:08

尝试更改:

->set('ctl.title', $data['title'])

 ->set('ctl.title', "'" . $data['title'] . "'")

和:

->set('ctl.description', $data['description'])

 ->set('ctl.description', "'" . $data['description'] . "'")

Try changing:

->set('ctl.title', $data['title'])

to

 ->set('ctl.title', "'" . $data['title'] . "'")

and:

->set('ctl.description', $data['description'])

to

 ->set('ctl.description', "'" . $data['description'] . "'")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文