Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php SQL语法验证_Php_Sql_Cakephp - Fatal编程技术网

Php SQL语法验证

Php SQL语法验证,php,sql,cakephp,Php,Sql,Cakephp,这是我的数据库结构: public $hasMany = array( 'Response' => array( 'className' => 'Response', 'foreignKey' => 'time_slot_id`' ) ); public $belongsTo = array( 'TimeSlot' => array( 'className' => 'TimeSl

这是我的数据库结构:

    public $hasMany = array(
    'Response' => array(
        'className' => 'Response',
        'foreignKey' => 'time_slot_id`'
    )
);
   public $belongsTo = array(
    'TimeSlot' => array(
        'className' => 'TimeSlot',
        'foreignKey' => 'time_slot_id'
    )
);
  $this->loadModel("TimeSlot");
  $time_slot = $this->TimeSlot->find("first");
  debug($time_slot);
   Database Error
   Error: 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 '`.`responses` AS `Response` WHERE `Response`.`time_slot_id` = (1)' at line 1

   SQL Query: SELECT `Response`.`id`, `Response`.`invitee_id`, `Response`.`time_slot_id`, `Response`.`time_slot_id`` FROM `meetingscheduler`.`responses` AS `Response` WHERE `Response`.`time_slot_id` = (1)

这是我的时间段的片段。php:

    public $hasMany = array(
    'Response' => array(
        'className' => 'Response',
        'foreignKey' => 'time_slot_id`'
    )
);
   public $belongsTo = array(
    'TimeSlot' => array(
        'className' => 'TimeSlot',
        'foreignKey' => 'time_slot_id'
    )
);
  $this->loadModel("TimeSlot");
  $time_slot = $this->TimeSlot->find("first");
  debug($time_slot);
   Database Error
   Error: 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 '`.`responses` AS `Response` WHERE `Response`.`time_slot_id` = (1)' at line 1

   SQL Query: SELECT `Response`.`id`, `Response`.`invitee_id`, `Response`.`time_slot_id`, `Response`.`time_slot_id`` FROM `meetingscheduler`.`responses` AS `Response` WHERE `Response`.`time_slot_id` = (1)
和Response.php:

    public $hasMany = array(
    'Response' => array(
        'className' => 'Response',
        'foreignKey' => 'time_slot_id`'
    )
);
   public $belongsTo = array(
    'TimeSlot' => array(
        'className' => 'TimeSlot',
        'foreignKey' => 'time_slot_id'
    )
);
  $this->loadModel("TimeSlot");
  $time_slot = $this->TimeSlot->find("first");
  debug($time_slot);
   Database Error
   Error: 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 '`.`responses` AS `Response` WHERE `Response`.`time_slot_id` = (1)' at line 1

   SQL Query: SELECT `Response`.`id`, `Response`.`invitee_id`, `Response`.`time_slot_id`, `Response`.`time_slot_id`` FROM `meetingscheduler`.`responses` AS `Response` WHERE `Response`.`time_slot_id` = (1)
当我将此行添加到会议中的操作时,控制器:

    public $hasMany = array(
    'Response' => array(
        'className' => 'Response',
        'foreignKey' => 'time_slot_id`'
    )
);
   public $belongsTo = array(
    'TimeSlot' => array(
        'className' => 'TimeSlot',
        'foreignKey' => 'time_slot_id'
    )
);
  $this->loadModel("TimeSlot");
  $time_slot = $this->TimeSlot->find("first");
  debug($time_slot);
   Database Error
   Error: 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 '`.`responses` AS `Response` WHERE `Response`.`time_slot_id` = (1)' at line 1

   SQL Query: SELECT `Response`.`id`, `Response`.`invitee_id`, `Response`.`time_slot_id`, `Response`.`time_slot_id`` FROM `meetingscheduler`.`responses` AS `Response` WHERE `Response`.`time_slot_id` = (1)
此结果为:

    public $hasMany = array(
    'Response' => array(
        'className' => 'Response',
        'foreignKey' => 'time_slot_id`'
    )
);
   public $belongsTo = array(
    'TimeSlot' => array(
        'className' => 'TimeSlot',
        'foreignKey' => 'time_slot_id'
    )
);
  $this->loadModel("TimeSlot");
  $time_slot = $this->TimeSlot->find("first");
  debug($time_slot);
   Database Error
   Error: 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 '`.`responses` AS `Response` WHERE `Response`.`time_slot_id` = (1)' at line 1

   SQL Query: SELECT `Response`.`id`, `Response`.`invitee_id`, `Response`.`time_slot_id`, `Response`.`time_slot_id`` FROM `meetingscheduler`.`responses` AS `Response` WHERE `Response`.`time_slot_id` = (1)

我有点困惑我的密码出了什么问题。但我认为这是时隙和响应模型之间的关系,因为一旦我忽略了这些关系,它就可以正常工作。

这里有一个额外的记号:

.`time_slot_id``
             ^^^

这里有一个额外的勾号:

.`time_slot_id``
             ^^^

这里有一个额外的勾号:

.`time_slot_id``
             ^^^

这里有一个额外的勾号:

.`time_slot_id``
             ^^^

哦,上帝。非常感谢你。我几乎没注意到那个。谢谢花了我几个小时。我以为我把模型设置错了。是那个该死的“`>”哦,天哪。非常感谢你。我几乎没注意到那个。谢谢花了我几个小时。我以为我把模型设置错了。是那个该死的“`>”哦,天哪。非常感谢你。我几乎没注意到那个。谢谢花了我几个小时。我以为我把模型设置错了。是那个该死的“`>”哦,天哪。非常感谢你。我几乎没注意到那个。谢谢花了我几个小时。我以为我把模型设置错了。就是那个该死的“`>_