0

This is my connector class

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);

and this the array

$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

);

i get this erroe

Fatal error: Uncaught PDOException: 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 'window=?,duration=?,startdate=?,enddate=?,Appbudget=?,grcont=?,dform=?,numroll=?' at line 1 in

Bwoye
  • 11
  • 2

1 Answers1

0

WINDOW is a reserved keyword. Backtick-wrap that thing.

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

WINDOW (R); added in 8.0.2 (reserved)

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

mickmackusa
  • 43,625
  • 12
  • 83
  • 136