I have put together three complicated prepared INSERTS now all of a sudden cannot get two simple ones to work.
$sql = "INSERT INTO randomTime (
transmissionProgramID,
numberOfTimes,
minimumGap,
randomTimeType,
lastUpdate
) VALUES (
:transmissionProgramID,
:numberOfTimes,
:minimumGap,
:randomTimeType,
:lastUpdate
);";
$statement = $pdo->prepare($sql);
var_dump($transmissionProgramID,$numberOfTimes,$randomTimeType, $minimumGap,$lastUpdate);
$statement->bindValue(':transmissionProgramID,', $transmissionProgramID);
$statement->bindValue(':numberOfTimes,', $numberOfTimes);
$statement->bindValue(':minimumGap,', $minimumGap);
$statement->bindValue(':randomTimeType,', $randomTimeType);
$statement->bindValue(':lastUpdate', $lastUpdate);
$result = $statement->execute();
… and I get "Parameter not defined
Cannot seem to add a picture but the table is short so…
CREATE TABLE `randomTime` (
`randomTimeID` INT(11) NOT NULL AUTO_INCREMENT,
`numberOfTimes` TINYINT(4) NOT NULL DEFAULT '1',
`minimumGap` SMALLINT(6) NOT NULL DEFAULT '60',
`randomTimeType` ENUM('average','fixed','maximum') NULL DEFAULT 'fixed',
`transmissionProgramID` INT(11) NOT NULL,
`lastUpdate` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`randomTimeID`),
UNIQUE INDEX `randomTimeID` (`randomTimeID`),
INDEX `FK_randomTime_transmissionProgram` (`transmissionProgramID`),
CONSTRAINT `FK_randomTime_transmissionProgram` FOREIGN KEY (`transmissionProgramID`) REFERENCES `transmissionProgram` (`transmissionProgramID`)
)
The var_dump produces what it should eg:
string(3) "131" string(1) "2" string(7) "average" int(200) string(19) "2016-03-01 14:36:42"
I tried an intval
on the numbers but that made no different and had not used intval
on the ones that worked.
Grateful for any help. Two hours and counting. And going bonkers not seeing what I have done wrong.