简体   繁体   English

MySQLi bind_param()不起作用

[英]MySQLi bind_param() not working

I have a rather odd issue with the PHP bind_param function for MySQLi. 我对MySQLi的PHP bind_param函数有一个很奇怪的问题。

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! 非常感谢!

'?' means a string with one symbol ? 是指带有一个符号的字符串? . Placeholder is just ? 占位符只是? :

$query = "UPDATE Applicants SET University_College=?, Notice_Period=?...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM