Php 更新失败:用户的Select命令被拒绝(vahejaba@localhost)

Php 更新失败:用户的Select命令被拒绝(vahejaba@localhost),php,mysql,pdo,Php,Mysql,Pdo,我在一个PHP应用程序中看到一条错误消息,它一直指向更新失败,但报告我的Select命令未被授予 SQLSTATE[42000]:语法错误或访问冲突:1142 SELECT 针对表“actionitems”的用户“vahejaba”@“localhost”的命令被拒绝 这是在上触发“选择授予无效”错误的更新方法vahejaba@loalhost. 为什么我在更新时会出现select错误,为什么我的用户名不正确(这是不正确的,因为我相信是我导致了错误) 请帮忙 database.php class

我在一个PHP应用程序中看到一条错误消息,它一直指向更新失败,但报告我的Select命令未被授予

SQLSTATE[42000]:语法错误或访问冲突:1142 SELECT 针对表“actionitems”的用户“vahejaba”@“localhost”的命令被拒绝

这是在上触发“选择授予无效”错误的更新方法vahejaba@loalhost.

为什么我在更新时会出现select错误,为什么我的用户名不正确(这是不正确的,因为我相信是我导致了错误)

请帮忙

database.php

class Database
{
    private static $instance;

    private $dbh;

    private static $dbengine = 'mysql';
    private $dbname;
    private static $dbhost = 'localhost';     

    function __construct()
    {      
        $this->dbname = "vahejaba_projectaim"; //str_replace('.projectaim.tools', '', $_SERVER['HTTP_HOST']); //Config::$dbname;
        $dbhost = Database::$dbhost;
        $dbengine = Database::$dbengine;
        $username = Config::$username;
        $password = Config::$password;

        try
        {
            $this->dbh = new PDO("$dbengine:host=$dbhost;dbname=$this->dbname", $username, $password);
        }
        catch (PDOException $e)
        {
            die("Error in establishing connection to database!");
        }
     }

    public function update($table, $colsVals=null, $whereVals=null)
    {
        $table = $this->getTable($table);
        $columns = "";
        $valuelist = array();
        $values = "";
        $params = array();
        $where = $this->where($whereVals);

        $wherestr = $where['wherestring'];
        $whereParams = $where['params'];

        $set = $this->set($colsVals);
        $setVals = $set['set'];
        $setParams = $set['params'];
        $setValsString = $set['setvals'];
        $vals = $set['vals'];
        $params = array_merge($whereParams, $setParams);


        if ($table !== FALSE)
        {
                try
                {
                    $dbname = $this->dbname;
                    $sql = $this->dbh->prepare("UPDATE $table SET $setValsString WHERE $wherestr");

                    $sql->execute($setParams);

                    $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                }
                catch (PDOException $e)
                {
                    die('Update failed: '.  $e->getMessage());
                }
        }
    }
}
   class Config
   {    
        static $username = 'vahejaba_user';
   }
class ManageActionItems
{
    private $db;
    private $dbh;
    private $userManager;
    private $cols;
    private $rowCount;
    private $vals;
    private $actionItemGrid;
    private $requiredCols;
    private $projectId;
    private $table;
    private $tool;


    function __construct($excludeCols = array(), $requiredCols = array(), $projectId)
    {
        $this->db = Database::getInstance();
        $this->userManager = new UserManager();
        $this->dbh = $this->db->getHandle();
        $this->table = 'ActionItems';
        $this->tool = 'actionitem';
        $this->requiredCols = $requiredCols;
        $this->projectId = $projectId;
        $this->actionItemGrid = new Grid($this->table, $excludeCols);
        $this->cols = $this->actionItemGrid->getCols();
        $this->rowCount = $this->actionItemGrid->getRowCount();
    }
    public function edit($id)
    {   
        if (isset($_SESSION['errmsg']))
            unset($_SESSION['errmsg']);

        $ymdDueDate = "";
        $ymdAssigned = "";
        $ymdECD = "";
        $ymdClosedDate = "";
        $ymdCompletionDate = "";

        $colsVals = array();

        if (isset($_POST['editAssignedDate']) && $_POST['editAssignedDate'] != "" && $this->checkDate($_POST['editAssignedDate']))
        {
            $mdy = preg_split('/\//',  $_POST['editAssignedDate']);
            $ymdAssigned = "$mdy[2]-$mdy[0]-$mdy[1]";
        }   
        else if (isset($_SESSION['AssignedDate']) && $_SESSION['AssignedDate'] != "")
        {
            $mdy = preg_split('/\//',  $_SESSION['AssignedDate']);
            $ymdAssigned = "$mdy[2]-$mdy[0]-$mdy[1]";
        }
        if (isset($_POST['editDueDate']) && $_POST['editDueDate'] != "" && $this->checkDate($_POST['editDueDate']))
        {
            $mdy = preg_split('/\//',  $_POST['editDueDate']);
            $ymdDueDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }
        else if (isset($_SESSION['DueDate']) && $_SESSION['DueDate'] != "")
        {
            $mdy = preg_split('/\//',  $_SESSION['DueDate']);
            $ymdDueDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }

        if (isset($_POST['editECD']) && $_POST['editECD'] != "" && $this->checkDate($_POST['editECD']))
        {
            $mdy = preg_split('/\//',  $_POST['editECD']);
            $ymdECD = "$mdy[2]-$mdy[0]-$mdy[1]";
        }
        else if (isset($_SESSION['ECD']) && $_SESSION['ECD'] != "")
        {
            $mdy = preg_split('/\//',  $_SESSION['ECD']);
            $ymdECD = "$mdy[2]-$mdy[0]-$mdy[1]";
        }

        if (isset($_POST['editClosedDate']) && $_POST['editClosedDate'] != "" && $this->checkDate($_POST['editClosedDate']))
        {
            $mdy = preg_split('/\//',  $_POST['editClosedDate']);
            $ymdClosedDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }
        else if (isset($_SESSION['ClosedDate']) && $_SESSION['ClosedDate'] != "")
        {
            $mdy = preg_split('/\//',  $_SESSION['ClosedDate']);
            $ymdClosedDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }

        if (isset($_POST['editCompletionDate']) && $_POST['editCompletionDate'] != "" && $this->checkDate($_POST['editCompletionDate']))
        {
            $mdy = preg_split('/\//',  $_POST['editCompletionDate']);
            $ymdCompletionDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }
        else if (isset($_SESSION['CompletionDate']) && $_SESSION['CompletionDate'] != "")
        {
            $mdy = preg_split('/\//',  $_SESSION['CompletionDate']);
            $ymdCompletionDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }

        $this->vals['AssignedDate'] = $ymdAssigned;
        $this->vals['DueDate'] = $ymdDueDate;
        $this->vals['ECD'] = $ymdECD;
        $this->vals['CompletionDate'] = $ymdCompletionDate;
        $this->vals['ClosedDate'] = $ymdClosedDate;



        if (isset($_POST['editAssignedDate']))
            $_SESSION['AssignedDate'] = $_POST['editAssignedDate'];
        if (isset($_POST['editDueDate']))
            $_SESSION['DueDate'] = $_POST['editDueDate'];

        if (isset($_POST['editECD']))            
            $_SESSION['ECD'] = $_POST['editECD'];

        if (isset($_POST['editCompletionDate']))
            $_SESSION['CompletionDate'] = $_POST['editCompletionDate'];
        if (isset($_POST['editClosedDate']))                           
            $_SESSION['ClosedDate'] = $_POST['editClosedDate'];


        $this->saveEditVals();
        if($ymdAssigned != "" && $ymdDueDate != "" && $ymdAssigned > $ymdDueDate)
        {
            $_SESSION['errmsg'] = 'Due Date Must be Greater or Equal to Assigned Date';
            return false;
        }
        else
        {
            unset($_SESSION['errmsg']);
        }



        foreach ($this->cols as $col)
        {
            if (array_key_exists($col, $_SESSION))
            {
                if($col != "ApproverID" && $col != "AltOwnerID" && $col != "OwnerID" && $col != "AssignorID" && $col != "AssignedDate" && $col != "DueDate" && $col != "ECD" && $col != "ClosedDate" && $col != "CompletionDate" && $col != "ID" && $col != "ActionItemID" && $col != "ProjectID")
                    $colsVals[$col] = $_SESSION[$col];
                else if($col == 'AssignorID' && isset($_SESSION[$col]) && $_SESSION[$col] != 0)
                    $colsVals[$col] = intval($_SESSION[$col]);
                else if($col == 'AltOwnerID' && isset($_SESSION[$col]) && $_SESSION[$col] != 0)
                    $colsVals[$col] = intval($_SESSION[$col]);
                else if($col == 'OwnerID'  && isset($_SESSION[$col]) && $_SESSION[$col] != 0)
                    $colsVals[$col] = intval($_SESSION[$col]);
                else if($col == 'ApproverID' && isset($_SESSION[$col]) && $_SESSION[$col] != 0)
                    $colsVals[$col] = intval($_SESSION[$col]);
                //else if ($col == 'AssignorID' || $col == 'AltOwnerID' || $col == 'ApproverID' || $col == 'OwnerID' && !isset($_SESSION[$col]))
                //  $colsVals[$col] = 'NULL';
            }

        }

       // $manageLockedFields = new ManageLockedFields('actionitem');

        $colsVals['AssignedDate'] = $ymdAssigned;

        $colsVals['DueDate'] = $ymdDueDate;

        $colsVals['ClosedDate'] = $ymdClosedDate;

        $colsVals['CompletionDate'] = $ymdCompletionDate;

        $colsVals['ECD'] = $ymdECD;

        $where = array();
        if ($id != null)
        {
           $where[] = array('Selector', '=', "'".substr($id, 0, 12)."'");
        }

        $this->db->update($this->table, $colsVals, $where); 
        return true;
    }
config.php

class Database
{
    private static $instance;

    private $dbh;

    private static $dbengine = 'mysql';
    private $dbname;
    private static $dbhost = 'localhost';     

    function __construct()
    {      
        $this->dbname = "vahejaba_projectaim"; //str_replace('.projectaim.tools', '', $_SERVER['HTTP_HOST']); //Config::$dbname;
        $dbhost = Database::$dbhost;
        $dbengine = Database::$dbengine;
        $username = Config::$username;
        $password = Config::$password;

        try
        {
            $this->dbh = new PDO("$dbengine:host=$dbhost;dbname=$this->dbname", $username, $password);
        }
        catch (PDOException $e)
        {
            die("Error in establishing connection to database!");
        }
     }

    public function update($table, $colsVals=null, $whereVals=null)
    {
        $table = $this->getTable($table);
        $columns = "";
        $valuelist = array();
        $values = "";
        $params = array();
        $where = $this->where($whereVals);

        $wherestr = $where['wherestring'];
        $whereParams = $where['params'];

        $set = $this->set($colsVals);
        $setVals = $set['set'];
        $setParams = $set['params'];
        $setValsString = $set['setvals'];
        $vals = $set['vals'];
        $params = array_merge($whereParams, $setParams);


        if ($table !== FALSE)
        {
                try
                {
                    $dbname = $this->dbname;
                    $sql = $this->dbh->prepare("UPDATE $table SET $setValsString WHERE $wherestr");

                    $sql->execute($setParams);

                    $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                }
                catch (PDOException $e)
                {
                    die('Update failed: '.  $e->getMessage());
                }
        }
    }
}
   class Config
   {    
        static $username = 'vahejaba_user';
   }
class ManageActionItems
{
    private $db;
    private $dbh;
    private $userManager;
    private $cols;
    private $rowCount;
    private $vals;
    private $actionItemGrid;
    private $requiredCols;
    private $projectId;
    private $table;
    private $tool;


    function __construct($excludeCols = array(), $requiredCols = array(), $projectId)
    {
        $this->db = Database::getInstance();
        $this->userManager = new UserManager();
        $this->dbh = $this->db->getHandle();
        $this->table = 'ActionItems';
        $this->tool = 'actionitem';
        $this->requiredCols = $requiredCols;
        $this->projectId = $projectId;
        $this->actionItemGrid = new Grid($this->table, $excludeCols);
        $this->cols = $this->actionItemGrid->getCols();
        $this->rowCount = $this->actionItemGrid->getRowCount();
    }
    public function edit($id)
    {   
        if (isset($_SESSION['errmsg']))
            unset($_SESSION['errmsg']);

        $ymdDueDate = "";
        $ymdAssigned = "";
        $ymdECD = "";
        $ymdClosedDate = "";
        $ymdCompletionDate = "";

        $colsVals = array();

        if (isset($_POST['editAssignedDate']) && $_POST['editAssignedDate'] != "" && $this->checkDate($_POST['editAssignedDate']))
        {
            $mdy = preg_split('/\//',  $_POST['editAssignedDate']);
            $ymdAssigned = "$mdy[2]-$mdy[0]-$mdy[1]";
        }   
        else if (isset($_SESSION['AssignedDate']) && $_SESSION['AssignedDate'] != "")
        {
            $mdy = preg_split('/\//',  $_SESSION['AssignedDate']);
            $ymdAssigned = "$mdy[2]-$mdy[0]-$mdy[1]";
        }
        if (isset($_POST['editDueDate']) && $_POST['editDueDate'] != "" && $this->checkDate($_POST['editDueDate']))
        {
            $mdy = preg_split('/\//',  $_POST['editDueDate']);
            $ymdDueDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }
        else if (isset($_SESSION['DueDate']) && $_SESSION['DueDate'] != "")
        {
            $mdy = preg_split('/\//',  $_SESSION['DueDate']);
            $ymdDueDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }

        if (isset($_POST['editECD']) && $_POST['editECD'] != "" && $this->checkDate($_POST['editECD']))
        {
            $mdy = preg_split('/\//',  $_POST['editECD']);
            $ymdECD = "$mdy[2]-$mdy[0]-$mdy[1]";
        }
        else if (isset($_SESSION['ECD']) && $_SESSION['ECD'] != "")
        {
            $mdy = preg_split('/\//',  $_SESSION['ECD']);
            $ymdECD = "$mdy[2]-$mdy[0]-$mdy[1]";
        }

        if (isset($_POST['editClosedDate']) && $_POST['editClosedDate'] != "" && $this->checkDate($_POST['editClosedDate']))
        {
            $mdy = preg_split('/\//',  $_POST['editClosedDate']);
            $ymdClosedDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }
        else if (isset($_SESSION['ClosedDate']) && $_SESSION['ClosedDate'] != "")
        {
            $mdy = preg_split('/\//',  $_SESSION['ClosedDate']);
            $ymdClosedDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }

        if (isset($_POST['editCompletionDate']) && $_POST['editCompletionDate'] != "" && $this->checkDate($_POST['editCompletionDate']))
        {
            $mdy = preg_split('/\//',  $_POST['editCompletionDate']);
            $ymdCompletionDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }
        else if (isset($_SESSION['CompletionDate']) && $_SESSION['CompletionDate'] != "")
        {
            $mdy = preg_split('/\//',  $_SESSION['CompletionDate']);
            $ymdCompletionDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }

        $this->vals['AssignedDate'] = $ymdAssigned;
        $this->vals['DueDate'] = $ymdDueDate;
        $this->vals['ECD'] = $ymdECD;
        $this->vals['CompletionDate'] = $ymdCompletionDate;
        $this->vals['ClosedDate'] = $ymdClosedDate;



        if (isset($_POST['editAssignedDate']))
            $_SESSION['AssignedDate'] = $_POST['editAssignedDate'];
        if (isset($_POST['editDueDate']))
            $_SESSION['DueDate'] = $_POST['editDueDate'];

        if (isset($_POST['editECD']))            
            $_SESSION['ECD'] = $_POST['editECD'];

        if (isset($_POST['editCompletionDate']))
            $_SESSION['CompletionDate'] = $_POST['editCompletionDate'];
        if (isset($_POST['editClosedDate']))                           
            $_SESSION['ClosedDate'] = $_POST['editClosedDate'];


        $this->saveEditVals();
        if($ymdAssigned != "" && $ymdDueDate != "" && $ymdAssigned > $ymdDueDate)
        {
            $_SESSION['errmsg'] = 'Due Date Must be Greater or Equal to Assigned Date';
            return false;
        }
        else
        {
            unset($_SESSION['errmsg']);
        }



        foreach ($this->cols as $col)
        {
            if (array_key_exists($col, $_SESSION))
            {
                if($col != "ApproverID" && $col != "AltOwnerID" && $col != "OwnerID" && $col != "AssignorID" && $col != "AssignedDate" && $col != "DueDate" && $col != "ECD" && $col != "ClosedDate" && $col != "CompletionDate" && $col != "ID" && $col != "ActionItemID" && $col != "ProjectID")
                    $colsVals[$col] = $_SESSION[$col];
                else if($col == 'AssignorID' && isset($_SESSION[$col]) && $_SESSION[$col] != 0)
                    $colsVals[$col] = intval($_SESSION[$col]);
                else if($col == 'AltOwnerID' && isset($_SESSION[$col]) && $_SESSION[$col] != 0)
                    $colsVals[$col] = intval($_SESSION[$col]);
                else if($col == 'OwnerID'  && isset($_SESSION[$col]) && $_SESSION[$col] != 0)
                    $colsVals[$col] = intval($_SESSION[$col]);
                else if($col == 'ApproverID' && isset($_SESSION[$col]) && $_SESSION[$col] != 0)
                    $colsVals[$col] = intval($_SESSION[$col]);
                //else if ($col == 'AssignorID' || $col == 'AltOwnerID' || $col == 'ApproverID' || $col == 'OwnerID' && !isset($_SESSION[$col]))
                //  $colsVals[$col] = 'NULL';
            }

        }

       // $manageLockedFields = new ManageLockedFields('actionitem');

        $colsVals['AssignedDate'] = $ymdAssigned;

        $colsVals['DueDate'] = $ymdDueDate;

        $colsVals['ClosedDate'] = $ymdClosedDate;

        $colsVals['CompletionDate'] = $ymdCompletionDate;

        $colsVals['ECD'] = $ymdECD;

        $where = array();
        if ($id != null)
        {
           $where[] = array('Selector', '=', "'".substr($id, 0, 12)."'");
        }

        $this->db->update($this->table, $colsVals, $where); 
        return true;
    }
manageActionItems.php

class Database
{
    private static $instance;

    private $dbh;

    private static $dbengine = 'mysql';
    private $dbname;
    private static $dbhost = 'localhost';     

    function __construct()
    {      
        $this->dbname = "vahejaba_projectaim"; //str_replace('.projectaim.tools', '', $_SERVER['HTTP_HOST']); //Config::$dbname;
        $dbhost = Database::$dbhost;
        $dbengine = Database::$dbengine;
        $username = Config::$username;
        $password = Config::$password;

        try
        {
            $this->dbh = new PDO("$dbengine:host=$dbhost;dbname=$this->dbname", $username, $password);
        }
        catch (PDOException $e)
        {
            die("Error in establishing connection to database!");
        }
     }

    public function update($table, $colsVals=null, $whereVals=null)
    {
        $table = $this->getTable($table);
        $columns = "";
        $valuelist = array();
        $values = "";
        $params = array();
        $where = $this->where($whereVals);

        $wherestr = $where['wherestring'];
        $whereParams = $where['params'];

        $set = $this->set($colsVals);
        $setVals = $set['set'];
        $setParams = $set['params'];
        $setValsString = $set['setvals'];
        $vals = $set['vals'];
        $params = array_merge($whereParams, $setParams);


        if ($table !== FALSE)
        {
                try
                {
                    $dbname = $this->dbname;
                    $sql = $this->dbh->prepare("UPDATE $table SET $setValsString WHERE $wherestr");

                    $sql->execute($setParams);

                    $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                }
                catch (PDOException $e)
                {
                    die('Update failed: '.  $e->getMessage());
                }
        }
    }
}
   class Config
   {    
        static $username = 'vahejaba_user';
   }
class ManageActionItems
{
    private $db;
    private $dbh;
    private $userManager;
    private $cols;
    private $rowCount;
    private $vals;
    private $actionItemGrid;
    private $requiredCols;
    private $projectId;
    private $table;
    private $tool;


    function __construct($excludeCols = array(), $requiredCols = array(), $projectId)
    {
        $this->db = Database::getInstance();
        $this->userManager = new UserManager();
        $this->dbh = $this->db->getHandle();
        $this->table = 'ActionItems';
        $this->tool = 'actionitem';
        $this->requiredCols = $requiredCols;
        $this->projectId = $projectId;
        $this->actionItemGrid = new Grid($this->table, $excludeCols);
        $this->cols = $this->actionItemGrid->getCols();
        $this->rowCount = $this->actionItemGrid->getRowCount();
    }
    public function edit($id)
    {   
        if (isset($_SESSION['errmsg']))
            unset($_SESSION['errmsg']);

        $ymdDueDate = "";
        $ymdAssigned = "";
        $ymdECD = "";
        $ymdClosedDate = "";
        $ymdCompletionDate = "";

        $colsVals = array();

        if (isset($_POST['editAssignedDate']) && $_POST['editAssignedDate'] != "" && $this->checkDate($_POST['editAssignedDate']))
        {
            $mdy = preg_split('/\//',  $_POST['editAssignedDate']);
            $ymdAssigned = "$mdy[2]-$mdy[0]-$mdy[1]";
        }   
        else if (isset($_SESSION['AssignedDate']) && $_SESSION['AssignedDate'] != "")
        {
            $mdy = preg_split('/\//',  $_SESSION['AssignedDate']);
            $ymdAssigned = "$mdy[2]-$mdy[0]-$mdy[1]";
        }
        if (isset($_POST['editDueDate']) && $_POST['editDueDate'] != "" && $this->checkDate($_POST['editDueDate']))
        {
            $mdy = preg_split('/\//',  $_POST['editDueDate']);
            $ymdDueDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }
        else if (isset($_SESSION['DueDate']) && $_SESSION['DueDate'] != "")
        {
            $mdy = preg_split('/\//',  $_SESSION['DueDate']);
            $ymdDueDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }

        if (isset($_POST['editECD']) && $_POST['editECD'] != "" && $this->checkDate($_POST['editECD']))
        {
            $mdy = preg_split('/\//',  $_POST['editECD']);
            $ymdECD = "$mdy[2]-$mdy[0]-$mdy[1]";
        }
        else if (isset($_SESSION['ECD']) && $_SESSION['ECD'] != "")
        {
            $mdy = preg_split('/\//',  $_SESSION['ECD']);
            $ymdECD = "$mdy[2]-$mdy[0]-$mdy[1]";
        }

        if (isset($_POST['editClosedDate']) && $_POST['editClosedDate'] != "" && $this->checkDate($_POST['editClosedDate']))
        {
            $mdy = preg_split('/\//',  $_POST['editClosedDate']);
            $ymdClosedDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }
        else if (isset($_SESSION['ClosedDate']) && $_SESSION['ClosedDate'] != "")
        {
            $mdy = preg_split('/\//',  $_SESSION['ClosedDate']);
            $ymdClosedDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }

        if (isset($_POST['editCompletionDate']) && $_POST['editCompletionDate'] != "" && $this->checkDate($_POST['editCompletionDate']))
        {
            $mdy = preg_split('/\//',  $_POST['editCompletionDate']);
            $ymdCompletionDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }
        else if (isset($_SESSION['CompletionDate']) && $_SESSION['CompletionDate'] != "")
        {
            $mdy = preg_split('/\//',  $_SESSION['CompletionDate']);
            $ymdCompletionDate = "$mdy[2]-$mdy[0]-$mdy[1]";
        }

        $this->vals['AssignedDate'] = $ymdAssigned;
        $this->vals['DueDate'] = $ymdDueDate;
        $this->vals['ECD'] = $ymdECD;
        $this->vals['CompletionDate'] = $ymdCompletionDate;
        $this->vals['ClosedDate'] = $ymdClosedDate;



        if (isset($_POST['editAssignedDate']))
            $_SESSION['AssignedDate'] = $_POST['editAssignedDate'];
        if (isset($_POST['editDueDate']))
            $_SESSION['DueDate'] = $_POST['editDueDate'];

        if (isset($_POST['editECD']))            
            $_SESSION['ECD'] = $_POST['editECD'];

        if (isset($_POST['editCompletionDate']))
            $_SESSION['CompletionDate'] = $_POST['editCompletionDate'];
        if (isset($_POST['editClosedDate']))                           
            $_SESSION['ClosedDate'] = $_POST['editClosedDate'];


        $this->saveEditVals();
        if($ymdAssigned != "" && $ymdDueDate != "" && $ymdAssigned > $ymdDueDate)
        {
            $_SESSION['errmsg'] = 'Due Date Must be Greater or Equal to Assigned Date';
            return false;
        }
        else
        {
            unset($_SESSION['errmsg']);
        }



        foreach ($this->cols as $col)
        {
            if (array_key_exists($col, $_SESSION))
            {
                if($col != "ApproverID" && $col != "AltOwnerID" && $col != "OwnerID" && $col != "AssignorID" && $col != "AssignedDate" && $col != "DueDate" && $col != "ECD" && $col != "ClosedDate" && $col != "CompletionDate" && $col != "ID" && $col != "ActionItemID" && $col != "ProjectID")
                    $colsVals[$col] = $_SESSION[$col];
                else if($col == 'AssignorID' && isset($_SESSION[$col]) && $_SESSION[$col] != 0)
                    $colsVals[$col] = intval($_SESSION[$col]);
                else if($col == 'AltOwnerID' && isset($_SESSION[$col]) && $_SESSION[$col] != 0)
                    $colsVals[$col] = intval($_SESSION[$col]);
                else if($col == 'OwnerID'  && isset($_SESSION[$col]) && $_SESSION[$col] != 0)
                    $colsVals[$col] = intval($_SESSION[$col]);
                else if($col == 'ApproverID' && isset($_SESSION[$col]) && $_SESSION[$col] != 0)
                    $colsVals[$col] = intval($_SESSION[$col]);
                //else if ($col == 'AssignorID' || $col == 'AltOwnerID' || $col == 'ApproverID' || $col == 'OwnerID' && !isset($_SESSION[$col]))
                //  $colsVals[$col] = 'NULL';
            }

        }

       // $manageLockedFields = new ManageLockedFields('actionitem');

        $colsVals['AssignedDate'] = $ymdAssigned;

        $colsVals['DueDate'] = $ymdDueDate;

        $colsVals['ClosedDate'] = $ymdClosedDate;

        $colsVals['CompletionDate'] = $ymdCompletionDate;

        $colsVals['ECD'] = $ymdECD;

        $where = array();
        if ($id != null)
        {
           $where[] = array('Selector', '=', "'".substr($id, 0, 12)."'");
        }

        $this->db->update($this->table, $colsVals, $where); 
        return true;
    }

在我的数据库(phpmyadmin)中,有一个触发器错误地指向错误的用户名和错误的数据库名称。在没有解决方案的情况下联系web主机后,我调查了触发器,发现了问题。修改参数消除了错误。

如果用户没有select访问权限,他们也不能更新,因为首先需要定位(IOW select)行才能更新它。因为它从来没有更新过,所以错误消息是关于用户对表有select访问权限。我相信我可能在某个地方操纵了下划线,但我没有看到它。这是在修改我的用户名或修改它。不太可能,至少在你在问题中发布的代码中不可能。更有可能是数据库中的权限设置或用户名错误。仔细检查使用phpAdmin或类似工具的用户的权限。遗憾的是,我在Web主机上使用的cpanel只为vahejaba_用户提供权限,而不是vahejaba,这是一个cpanel登录。如果他们不提供至少phpAdmin,我会切换主机。无论您在托管费上节省了多少,调试时间都会很快用完。我每月花11美元购买无限的域名、磁盘空间和带宽。