我有一个应该收集用户数据和照片的表格,但是每次我按下注册按钮时,文件都会上传,但是另一个表格变量不会在数据库中注册
if(move_uploaded_file($file_loc,$folder.$final_file)) {
$stmt = $DB_con->prepare(' INSERT INTO tbl_users
( userName, userMarital, userReligion, userNationality,
userCountry, userState, userCity, userEmail, userPhone,
userPhoto, userQualification, userFeild, userInstitution,
userNok, nokRelationship, nokNumber, userFacebook,
userInstagram, userTwiter, userColor, userEye, userHeight,
userHip, userBurst, userWaist, userShoulder, userLikes,
userDislikes, userTalents, userFavcolor, userFavpal,
tokenCode)
VALUES (:userName, :userMarital, :userReligion, :userNationality,
:userCountry, :userState, :userCity, :userEmail,
:userPhone, :userPhoto, :userQualification, :userFeild,
:userInstitution, :userNok, :nokRelationship, :nokNumber,
:userFacebook, :userInstagram, :userTwiter, :userColor,
:userEye, :userHeight, :userHip, :userBurst, :userWaist,
:userShoulder, :userLikes, :userDislikes, :userTalents,
:userFavcolor, :userFavpal, :activeCode)');
$stmt->bindParam(':userName', $userName);
$stmt->bindParam(':userMarital', $userMarital);
$stmt->bindParam(':userReligion', $userReligion);
$stmt->bindParam(':userNationality', $userNationality);
$stmt->bindParam(':userCountry', $userCountry);
$stmt->bindParam(':userState', $userState);
$stmt->bindParam(':userCity', $userCity);
$stmt->bindParam(':userEmail', $userEmail);
$stmt->bindParam(':userPhone', $userPhone);
$stmt->bindParam(':userPhoto', $userPhoto);
$stmt->bindParam(':userQualification', $userQualification);
$stmt->bindParam(':userFeild', $userFeild);
$stmt->bindParam(':userInstitution', $userInstitution);
$stmt->bindParam(':userNok', $userNok);
$stmt->bindParam(':nokRelationship', $nokRelationship);
$stmt->bindParam(':nokNumber', $nokNumber);
$stmt->bindParam(':userFacebook', $userFacebook);
$stmt->bindParam(':userInstagram', $userInstagram);
$stmt->bindParam(':userTwiter', $userTwiter);
$stmt->bindParam(':userColor', $userColor);
$stmt->bindParam(':userEye', $userEye);
$stmt->bindParam(':userHeight', $userHeight);
$stmt->bindParam(':userHip', $userHip);
$stmt->bindParam(':userBurst', $userBurst);
$stmt->bindParam(':userWaist', $userWaist);
$stmt->bindParam(':userShoulder', $userShoulder);
$stmt->bindParam(':userLikes', $userLikes);
$stmt->bindParam(':userDislikes', $userDislikes);
$stmt->bindParam(':userTalents', $userTalents);
$stmt->bindParam(':userFavcolor', $userFavcolor);
$stmt->bindParam(':userFavpal', $userFavpal);
$stmt->bindParam(':activeCode', $code);
if ($stmt->rowCount() == 1) {
$response['status'] = 'success';
$response['message'] = '<span class="glyphicon glyphicon-ok"></span> registered sucessfully, you may login now';
} else {
$response['status'] = 'error'; // could not register
$response['message'] = '<span class="glyphicon glyphicon-info-sign"></span> could not register, try again later';
}
}
答案 0 :(得分:0)
好吧,根据我在代码示例中看到的内容,您已经准备了一个查询并使用了绑定参数,但是从未执行过以下查询:
$stmt->execute();
我以为您使用的是mysqli,如果您使用的是其他驱动程序,请询问如何执行查询。