我一直收到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中运行良好