Searched SO first, I can't find an answer that is fit for my problem. Found some fixes but it doesn't do the trick. I'm trying to insert 40 variables into a row. The execute()
function returns
SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
I have even used a "Text difference checker" to check whether the params in the VALUES and my bindparam()
do not have any typos in it and nothing came out.
$stmt = $conn->prepare("INSERT INTO `wp_coachview_selecterenOpleiding`
VALUES (:OpleidingId,:OpleidingsSoortId,:BeginDatumInteger,
:BeginDatum,:BeginDatumString,:EindDatumInteger,
:EindDatumString,:EindDatum,:BeginEindDatum,
:OpleidingsSoortNaam,:OpleidingsSoortCode,:OpleidingsSoort,
:Code,:Naam,:Opleiding,
:AantalBezet,:AantalVrij,:IsAantalVrijNull,
:MinCursisten,:IsMinCursistenNull,:MaxCursisten,
:IsMaxCursistenNull,:Opmerking,:ContactPersonId,
:ContactPersonNaam,:ContactPerson2Id,:ContactPerson2Naam,
:OpleidingStatusId,:OpleidingStatusNaam,:PublicatieWebsite,
:PublicatiePlanning,:Planningstype,:PlanningsfrequentieAantal,
:PlanningsfrequentieTijdseenheid,:PlanningWeekdagen,:PlanningConflictafhandeling,
:TotAantalUur,:TotStudieBelasting,:TotAantalOnderdelen)");
$stmt->bindParam(':OpleidingId', ($opleiding['OpleidingId']) ? $opleiding['OpleidingId'] : 'NULL');
$stmt->bindParam(':OpleidingsSoortId', ($opleiding['OpleidingsSoortId']) ? $opleiding['OpleidingsSoortId'] : 'NULL');
$stmt->bindParam(':BeginDatumInteger', ($opleiding['BeginDatumInteger']) ? $opleiding['BeginDatumInteger'] : 'NULL' );
$stmt->bindParam(':BeginDatum', ($opleiding['BeginDatum']) ? $opleiding['BeginDatum'] : 'NULL' );
$stmt->bindParam(':BeginDatumString', ($opleiding['BeginDatumString']) ? $opleiding['BeginDatumString'] : 'NULL' );
$stmt->bindParam(':EindDatumInteger ', ($opleiding['EindDatumInteger']) ? $opleiding['EindDatumInteger'] : 'NULL' );
$stmt->bindParam(':EindDatumString', ($opleiding['EindDatumString']) ? $opleiding['EindDatumString'] : 'NULL' );
$stmt->bindParam(':EindDatum', ($opleiding['EindDatum']) ? $opleiding['EindDatum'] : 'NULL' );
$stmt->bindParam(':BeginEindDatum', ($opleiding['BeginEindDatum']) ? $opleiding['BeginEindDatum'] : 'NULL' );
$stmt->bindParam(':OpleidingsSoortNaam', ($opleiding['OpleidingsSoortNaam']) ? $opleiding['OpleidingsSoortNaam'] : 'NULL' );
$stmt->bindParam(':OpleidingsSoortCode', ($opleiding['OpleidingsSoortCode']) ? $opleiding['OpleidingsSoortCode'] : 'NULL' );
$stmt->bindParam(':OpleidingsSoort', ($opleiding['OpleidingsSoort']) ? $opleiding['OpleidingsSoort'] : 'NULL' );
$stmt->bindParam(':Code', ($opleiding['Code']) ? $opleiding['Code'] : 'NULL' );
$stmt->bindParam(':Naam', ($opleiding['Naam']) ? $opleiding['Naam'] : 'NULL' );
$stmt->bindParam(':Opleiding', ($opleiding['Opleiding']) ? $opleiding['Opleiding'] : 'NULL' );
$stmt->bindParam(':AantalBezet', ($opleiding['AantalBezet']) ? $opleiding['AantalBezet'] : 'NULL' );
$stmt->bindParam(':AantalVrij', ($opleiding['AantalVrij']) ? $opleiding['AantalVrij'] : 'NULL' );
$stmt->bindParam(':IsAantalVrijNull', ($opleiding['IsAantalVrijNull']) ? $opleiding['IsAantalVrijNull'] : 'NULL' );
$stmt->bindParam(':MinCursisten', ($opleiding['MinCursisten']) ? $opleiding['MinCursisten'] : 'NULL' );
$stmt->bindParam(':IsMinCursistenNull', ($opleiding['IsMinCursistenNull']) ? $opleiding['IsMinCursistenNull'] : 'NULL' );
$stmt->bindParam(':MaxCursisten', ($opleiding['MaxCursisten']) ? $opleiding['MaxCursisten'] : 'NULL' );
$stmt->bindParam(':IsMaxCursistenNull', ($opleiding['IsMaxCursistenNull']) ? $opleiding['IsMaxCursistenNull'] : 'NULL' );
$stmt->bindParam(':Opmerking', ($opleiding['Opmerking']) ? $opleiding['Opmerking'] : 'NULL' );
$stmt->bindParam(':ContactPersonId', ($opleiding['ContactPersonId']) ? $opleiding['ContactPersonId'] : 'NULL' );
$stmt->bindParam(':ContactPersonNaam', ($opleiding['ContactPersonNaam']) ? $opleiding['ContactPersonNaam'] : 'NULL' );
$stmt->bindParam(':ContactPerson2Id', ($opleiding['ContactPerson2Id']) ? $opleiding['ContactPerson2Id'] : 'NULL' );
$stmt->bindParam(':ContactPerson2Naam', ($opleiding['ContactPerson2Naam']) ? $opleiding['ContactPerson2Naam'] : 'NULL' );
$stmt->bindParam(':OpleidingStatusId', ($opleiding['OpleidingStatusId']) ? $opleiding['OpleidingStatusId'] : 'NULL' );
$stmt->bindParam(':OpleidingStatusNaam', ($opleiding['OpleidingStatusNaam']) ? $opleiding['OpleidingStatusNaam'] : 'NULL' );
$stmt->bindParam(':PublicatieWebsite', ($opleiding['PublicatieWebsite']) ? $opleiding['PublicatieWebsite'] : 'NULL' );
$stmt->bindParam(':PublicatiePlanning', ($opleiding['PublicatiePlanning']) ? $opleiding['PublicatiePlanning'] : 'NULL' );
$stmt->bindParam(':Planningstype', ($opleiding['Planningstype']) ? $opleiding['Planningstype'] : 'NULL' );
$stmt->bindParam(':PlanningsfrequentieAantal', ($opleiding['Planningsfrequentie_aantal']) ? $opleiding['Planningsfrequentie_aantal'] : 'NULL' );
$stmt->bindParam(':PlanningsfrequentieTijdseenheid', ($opleiding['Planningsfrequentie_tijdseenheid']) ? $opleiding['Planningsfrequentie_tijdseenheid'] : 'NULL' );
$stmt->bindParam(':PlanningWeekdagen', ($opleiding['PlanningWeekdagen']) ? $opleiding['PlanningWeekdagen'] : 'NULL' );
$stmt->bindParam(':PlanningConflictafhandeling', ($opleiding['PlanningConflictafhandeling']) ? $opleiding['PlanningConflictafhandeling'] : 'NULL' );
$stmt->bindParam(':TotAantalUur', ($opleiding['TotAantalUur']) ? $opleiding['TotAantalUur'] : 'NULL' );
$stmt->bindParam(':TotStudieBelasting', ($opleiding['TotStudieBelasting']) ? $opleiding['TotStudieBelasting'] : 'NULL' );
$stmt->bindParam(':TotAantalOnderdelen', ($opleiding['TotAantalOnderdelen']) ? $opleiding['TotAantalOnderdelen'] : 'NULL' );
I'd love to know what I'm doing wrong. 39 params in the query, 39 params being bound.
Pardon my whitespacing, I've been doing this for a while and I used the tab spacing to be able to look at things more evenly.