duanlu7680 2015-11-29 16:37
浏览 49
已采纳

MySQLi bind_param()不起作用

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.
", $stmt->affected_rows);                     

Any help is much appreciated!

Thanks a lot!

  • 写回答

1条回答 默认 最新

  • dongle0396 2015-11-29 16:39
    关注

    '?' means a string with one symbol ?. Placeholder is just ?:

    $query = "UPDATE Applicants SET University_College=?, Notice_Period=?...
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥15 Oracle触发器记录修改前后的字段值
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题