我运行此命令时得到一个数组

问题描述 投票:-1回答:1

这是我的连接器类

public function run($sql, $args = [])
    {
        echo "From connector";

        //exit();
        if (!$args) {
            return $this->pdo->query($sql);
        }

        echo $sql;

        $stmt = $this->pdo->prepare($sql);      
        $stmt->execute($args);
        return $stmt;
    }





$conn->run("UPDATE " . TBL_ENTITIES . " SET fileno=:fileno,Beneficiaryno=:Beneficiaryno,entype=:entype,Granteename=:Granteename,paddress=:paddress,contperson=:contperson,contphone=:contphone,Districtcode=:Districtcode,Sectorcode=:Sectorcode,window=:window,duration=:duration,startdate=:startdate,enddate=:enddate,Appbudget=:Appbudget,grcont=:grcont,dform=:dform,numroll=:numroll,emppass=:emppass,catid=:catid,catcreteria=:catcreteria WHERE fileno=:oldfileno", $myobj);

和这个数组

$myobj = array(
(
    [Granteename] => Abia Cacalo Foundation
    [paddress] =>
    [contperson] => Rev. Martin Luther Ogwal
    [contphone] => 0772910004
    [Districtcode] => 11
    [Sectorcode] => 1
    [fileno] => SDF/W2/86/2017
    [entype] => sd1
    [window] => 2
    [startdate] => 2020-01-06
    [enddate] =>
    [duration] => 3
    [Appbudget] => 45078000.00
    [grcont] => 13760000.00
    [dform] => M
    [numroll] => 150
    [catid] => 0
    [catcreteria] => 0
    [oldfile] => SDF/W2/86/2017

);

我得到这个错误

致命错误:未捕获的PDOException:SQLSTATE [42000]:语法错误或访问冲突:1064您在您的SQL语法;查看与您的MySQL服务器版本相对应的手册,以在附近使用正确的语法'window = ?, duration = ?, startdate = ?, enddate = ?, Appbudget = ?, grcont = ?, dform = ?, numroll =?'在第1行中

php pdo
1个回答
0
投票

WINDOW是保留关键字。反引号包裹那个东西。

https://dev.mysql.com/doc/refman/8.0/en/window-functions.html

WINDOW(R);在8.0.2中添加(保留)

来源:https://dev.mysql.com/doc/refman/8.0/en/keywords.html#keywords-8-0-detailed-W

© www.soinside.com 2019 - 2024. All rights reserved.