我对php和mysql是新手。我的服务器有5.6版本的mysql。我使用的是过程语句(不是pdo,不是oo)。这是一个php页面上的网站,我正在为用户创建一个新的帐户开发。奇怪的是,错误消息是在实际页面本身返回的(https://mywebsite.com/create_account.php)而不是在服务器的错误日志中。
- 以下是我收到的错误消息:*
错误:在用户(用户名、密码、姓名首字母、姓名尾字母、地址1、地址2、城市、州、邮政编码、电子邮件地址、电话号码、卡上姓名、卡号主字母、卡号ccv、卡号过期时间、卡号过期时间)值(?、?、?、?、?、?、?、?、?、?、?、?、?)中插入sql语法错误;请查看与您的mysql服务器版本对应的手册,以了解在“?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)”附近使用的正确语法
- 以下是生成错误消息的代码:*
//
// Insert data into database
//
$sql = "INSERT INTO users (username, password, name_first, name_last, address_1, address_2, city, state, zip_code, email_address, phone_number, name_on_card, card_number_main, card_number_ccv, card_expire_mo, card_expire_yr) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
$stmt = mysqli_prepare($link, $sql);
mysqli_stmt_bind_param($stmt, "ssssssssssssssss", $param_username, $param_password, $param_name_first, $param_name_last, $param_address_1, $param_address_2, $param_city, $param_state, $param_zip_code, $param_email_address, $param_phone_number, $param_name_on_card, $param_card_number_main, $param_card_number_ccv, $param_card_expire_mo, $param_card_expire_yr);
$param_username = $username;
$param_password = $password;
$param_name_first = $name_first;
$param_name_last = $name_last;
$param_address_1 = $address_1;
$param_address_2 = $address_2;
$param_city = $city;
$param_state = $state;
$param_zip_code = $zip_code;
$param_email_address = $email_address;
$param_phone_number = $phone_number;
$param_name_on_card = $name_on_card;
$param_card_number_main = $card_number_main;
$param_card_number_ccv = $card_number_ccv;
$param_card_expire_mo = $card_expire_mo;
$param_card_expire_yr = $card_expire_yr;
mysqli_stmt_execute($stmt);
我已按错误信息所示阅读了手册,但没有用。任何帮助都将不胜感激。谢谢您。
1条答案
按热度按时间um6iljoc1#
在变量声明bind stmt之后移动?