Reputation: 33
I have a rather odd issue with the PHP bind_param function for MySQLi.
I create the query with ?'s where the parameters will be bound, I prepare the statement, I bind the parameters and then I execute the statement. For some reason it is not binding the parameters. The system is a prototype recruitment software and this is used to update the details for a registered applicant.
Here is the code:
$query = "UPDATE Applicants SET University_College='?', Notice_Period='?', Wanting_To_Leave='?', Reason_Leaving='?', Interviews_Arranged='?', Companies_To_Contact='?', Like_To_Work_For='?', Applicant_Division='?', Applicant_First_Name='?', Applicant_Last_Name='?', T_P_C='?', Applicant_Phone_Number='?', Applicant_Mobile='?', Applicant_Email='?', Applicant_Current_Company='?', Applicant_Current_Job_Title='?', Applicant_Current_Salary='?', Applicant_Miles_To_Work='?', Applicant_Consultants_ID='?', Applicant_Title='?', Applicant_DOU=NOW(), Applicant_Industry='?', Applicant_Languages='?', Applicant_Employment_Status='?', Applicant_Advert='?', Applicant_Town='?', Applicant_Country='?', Applicant_Address='?', Applicant_Postcode='?', Applicant_Qualification_Level='?', Applicant_Qualification_Field='?', Applicant_Notice_Period='?', CV_Text='?' WHERE Applicant_ID='?' ";
$stmt = $con->prepare($query);
$stmt->bind_param("ssssssssssssssssssisssssssssssssi", $UniversityCollege, $NoticePeriod, $WantingToLeave, $ReasonLeaving, $InterviewsArranged, $CompaniesToContact, $LikeToWorkFor, $ApplicantDivision, $ApplicantFirstName, $ApplicantLastName, $TPC, $ApplicantPhoneNumber, $ApplicantMobile, $ApplicantEmail, $ApplicantCurrentCompany, $ApplicantCurrentJob, $ApplicantCurrentSalary, $ApplicantMilesToWork, $ConsultantsID, $ApplicantTitle, $ApplicantIndustry, $ApplicantLanguages, $ApplicantEmploymentStatus, $ApplicantAdvert, $ApplicantTown, $ApplicantCountry, $ApplicantAddress, $ApplicantPostcode, $ApplicantQualificationLevel, $ApplicantQualificationField, $ApplicantNoticePeriod, $CVText, $ApplicantID);
$stmt->execute() or die("Something went wrong, could not update applicant :-(");
printf("%d Row inserted.\n", $stmt->affected_rows);
Any help is much appreciated!
Thanks a lot!
Upvotes: 1
Views: 817
Reputation: 54841
'?'
means a string with one symbol ?
.
Placeholder is just ?
:
$query = "UPDATE Applicants SET University_College=?, Notice_Period=?...
Upvotes: 2