1

我不断收到 PDO 错误代码:00000

当我 var_dump 语句并将其复制到 MySQL Workbench 时,查询仍然有效。只是不适用于我的 php 页面。

代码如下:

if ($query->execute($bindValues))
                    {
                        if ($query->rowCount())
                        {
                            $changes = true;
                            /*
                            *   SET REG DATA TO SEND BACK
                            */
                            if (!$teamPermID)
                            {
                                $teamPermID = $pdoLink->lastInsertId();

                                if ($this->setTeamPermID($teamPermID))
                                {
                                    $_SESSION[$this->getEnvironment()]['Reg']['TeamRecord'][$typeOfTeam]['RegistrationInfo']['TeamPermID'] = $teamPermID;
                                    if (($teamRegistering) && (!$dbData['TeamPermIDSet']))
                                    {
                                        if ($typeOfTeam == 'club')
                                        {
                                            $dbData['TeamRegSQL'] .= " , ClubPermID = :teamPermID";
                                        }
                                        else if ($typeOfTeam == 'wogroup')
                                        {
                                            $dbData['TeamRegSQL'] .= " , WOGroupID = :teamPermID";  
                                        }
                                        $dbData['TeamRegBindValues'][":teamPermID"] = $teamPermID;
                                    }
                                }
                                else
                                {
                                    $_SESSION[$this->getEnvironment()]['Reg']['TeamRecord'][$typeOfTeam]['ErrorMessage'] = " Trouble sending information to database. No information has been saved. Please try again later 1.";
                                    return false;
                                }                                   
                            }
                            else
                            {
                                $_SESSION[$this->getEnvironment()]['Reg']['TeamRecord'][$typeOfTeam]['RegistrationInfo']['TeamPermID'] = $teamPermID;   
                            }
                        }
                    }
                    else
                    {
                        $_SESSION[$this->getEnvironment()]['Reg']['TeamRecord'][$typeOfTeam]['ErrorMessage'] = " Trouble sending information to database. No information has been saved. Please try again later 2-3" . $pdoLink->errorCode() . json_encode($pdoLink->errorInfo()) . $dbData['TeamSQL'] . json_encode($bindValues);
                        return false;
                    }

我尝试从以下位置更改查询:

if ($query->execute($bindValues))

至:

if ($query->execute($bindValues) === true)

它仍然每次都失败。任何帮助将不胜感激。

输出查询:

INSERT INTO Clubs 
SET DateAdded = "2017-09-26 21:06:54", 
LastModified = "2017-09-26 21:06:54", 
ModifiedBy = "0" , 
LMSCID = "14" , 
Year = "2017", 
ClubNumber = "145" , 
ClubID = "147-145" , 
ClubAbbr = "TNF" , 
ClubName = "Test New Fields" , 
ClubWebsite = "" ,
MemberCardImage = "" , 
ClubNotificationEmailAddress = "test@utesting.org" , 
ContactSwimmerID = "", 
ContactIsCoach = "0" , 
ContactFirstName = "Testing" , 
ContactLastName = "Test" , 
ContactAddress = "123 Street Rd" ,
CoachFirstName = "Fn" ,
CoachLastName = "Ln" ,
CoachSwimmerID = "34512" ,
ClubDescription = "" ,
ClubPracticeTimes = "", 
ClubFacebook = "" , 
ClubPhoto = "" , 
ContactCity = "Philadelphia", 
ContactStateAbbr = "PA" , 
ContactZip = "19038" , 
ContactPrimaryPhone = "(215) 555-6666" , 
ContactPrimaryPhoneContact = "0" , 
ContactSecondaryPhone = "0" , 
ContactSecondaryPhoneContact = "0" , 
ContactEmailAddress = "test@utesting.org" , 
ContactEmailAddressSecondary = ""

无法弄清楚代码有什么问题。它在 MySQL Workbench 中执行良好

4

0 回答 0