mysql定义变量字符串类型_mysqli_stmt :: bind_param():类型定义字符串中的元素数量与绑定变量的数量不匹配...
发布日期:2021-06-24 17:54:47 浏览次数:2 分类:技术文章

本文共 4028 字,大约阅读时间需要 13 分钟。

因此,我需要执行大量令人头痛的查询,涉及到需要使用mysqli预准备语句将 65个 表单输入注入数据库的查询。

我遇到的问题是它说我尝试调用的变量数bind_param与我正在使用的“ s”数不匹配。 我数了十二遍

,看不到我要去哪里错了。有65个变量和65个“ s”。

谁能看到我想念的东西?还是我可能以错误的方式使用bind_param方法?

// Preparing our query statement via mysqli which will auto-escape all bad characters to prevent injection

$query3 = 'INSERT INTO datashep_AMS.COMPLETE_APPLICATIONS (

project_name,

status,

funding_requested,

project_title,

program,

county,

parish,

name_of_watercourse,

which_is_a_tributary_of,

name_of_applicant,

contact_person_or_project_supervisor,

relationship_to_organization,

business_phone,

home_phone,

email,

signature_of_thesis_or_study_supervisor,

mailing_address,

postal_code,

website,

mailing_address_for_payment,

hst_registration_no,

total_cost_dollar,

total_cost_percent,

dollar_amount_requested_from_nbwtf,

percent_amount_requested_from_nbwtf,

descriptive_summary,

background_of_organization,

mandate,

years_in_existence,

membership,

accomplishments,

previous_project_name,

previous_project_number,

previous_project_amount_received_from_nbwtf,

summary_of_activities,

summary_of_Results,

project_title_2,

reason_and_or_purpose,

objectives,

project_description,

methods,

equipment_and_materials_required,

personnel_required,

proposed_start_date,

proposed_end_date,

type_of_data_to_be_stored,

where_will_it_be_housed,

monitoring,

short_term_achievement,

long_term_achievement,

previous_studies,

required_permits,

consultants,

short_term_commitment,

long_term_commitment,

project_duration,

project_evaluation,

promotion_of_project,

promotion_of_client,

publication_of_results,

community_benefits,

effects_on_traditional_uses,

possible_changes_in_public_access_to_areas,

possible_impact_on_wildlife_and_or_environment,

likelihood_of_future_requests_for_funding,

list_all_other_funding_sources_for_this_project

) VALUES (

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?,

?

)';

// "Preparing" the query using mysqli->prepare(query) -- which is the equivalent of mysql_real_escape_string -- in other words, it's the SAFE database injection method

$stmt = $dbConnection->prepare($query3);

// "Bind_param" == replace all the "?"'s in the aforementioned query with the variables below

$stmt->bind_param("s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s,s", $project_name, $status, $funding_requested, $project_title, $program, $county, $parish, $name_of_watercourse, $which_is_a_tributary_of, $name_of_applicant, $contact_person_or_project_supervisor, $relationship_to_organization, $business_phone, $home_phone, $email, $signature_of_thesis_or_study_supervisor, $mailing_address, $postal_code, $website, $mailing_address_for_payment, $hst_registration_no, $total_cost_dollar, $total_cost_percent, $dollar_amount_requested_from_nbwtf, $percent_amount_requested_from_nbwtf, $descriptive_summary, $background_of_organization, $mandate, $years_in_existence, $membership, $accomplishments, $previous_project_name, $previous_project_number, $previous_project_amount_received_from_nbwtf, $summary_of_activities, $summary_of_Results, $project_title_2, $reason_and_or_purpose, $objectives, $project_description, $methods, $equipment_and_materials_required, $personnel_required, $proposed_start_date, $proposed_end_date, $type_of_data_to_be_stored, $where_will_it_be_housed, $monitoring, $short_term_commitment, $long_term_achievement, $previous_studies, $required_permits, $consultants, $short_term_commitment, $long_term_commitment, $project_duration, $project_evaluation, $promotion_of_project, $promotion_of_client, $publication_of_results, $community_benefits, $effects_on_traditional_uses, $possible_changes_in_public_access_to_areas, $possible_impact_on_wildlife_and_or_environment, $likelihood_of_future_requests_for_funding, $list_all_other_funding_sources_for_this_project);

// Perform the actual query!

$stmt->execute();

转载地址:https://blog.csdn.net/weixin_34237125/article/details/113949833 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:mysql测试数据100w_利用MySQL存储过程批量插入100W条测试数据
下一篇:go mysql 多并发_MySQL并发处理-Go语言中文社区

发表评论

最新留言

关注你微信了!
[***.104.42.241]2024年04月14日 12时17分10秒