gpt4 book ai didi

php - MySql 语法错误 - 42000

转载 作者:行者123 更新时间:2023-11-29 04:25:00 25 4
gpt4 key购买 nike

我收到这个错误:

Warning: PDO::query() [pdo.query]: 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 'When, RDV, Comments FROM distributions WHERE IDFond = 1' at line 1 in /Applications/XAMPP/xamppfiles/htdocs/JG/DistributionManager.class.php on line 56

执行这段代码时:

$Distribution_Manager->getListByFunds($Selected_Fond->id());

foreach ($Distribution_Manager as $Distrib)
{
echo $Distrib->Comments();
}

这里是相关函数:

  public function getListByFunds($FundID)
{
$Distribution = array();

$q = $this->_db->query('SELECT id, IDClient, IDFond, Who, When, RDV, Comments FROM distributions WHERE IDFond = '.$FundID);

while ($donnees = $q->fetch(PDO::FETCH_ASSOC))
{
$Distribution[] = new Distribution($donnees);
}
return $Distribution;
}

应该是一个小错误,但我已经落后了将近 50 分钟!在此先感谢您的帮助;)

最佳答案

WHENmysql reserved word , 因此请尝试使用不同的列名称或将 WHEN 括在反引号中。

关于php - MySql 语法错误 - 42000,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13643598/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com