我这里有一个非常奇特的错误。类等被截断以提高可读性。
SHORT DESC:向字段发布值nationality
会将字段从 0 更改为 1,反之亦然,同时将下一个字段的值更改为用户在国籍字段中输入的第一个字符。如果重复(使用不同的输入更新用户输入的表单重新提交),第一个字母将转移到下一个字段,而新输入的国籍字段的第一个字母是前一个字段。这深入了三个领域,之后就没有更多的“鬼变”了。
如何阻止它并将国籍纳入国籍领域?
详细描述:
我所拥有的:我在 Mysql 5.1.61(客户端)和 5.5.28-log(srvr) 环境中有一个表“用户”。
该表曾经包含以下字段:
{birthdate, gender, phone, mobile}
我使用 qry { 在性别之前添加了一个字段ALTER TABLE 'user' ADD 'nationality' varchar(40) AFTER 'birthdate'}
导致
{birthdate, nationality, gender, phone, mobile}
我用发布这些值的表单中的数据为表格提供数据:
if ($resp->is_valid) {
registerNewUser($_POST['email'],$_POST['name'],$_POST['firstname'], $_POST['password']);
updateCurrentUser($_POST['email'], $_POST['name'], $_POST['firstname'], $_POST['date_of_birth'], $_POST['nationality'], $_POST['gender'], $_POST['telephone'], $_POST['mobile']);
updateCurrentUser
看起来像这样:
function &updateCurrentUser($email, $name, $firstname, $street, $city, $postalCode, $DateOfBirth, $nationality, $gender, , $telephone, $mobile, $hasRoomForRent, $isIaesteMember, $hasMadeTraineeship, $password, $dataApproved){
$dbh = getPDO();
$stmt = $dbh->prepare('UPDATE user SET name = :name, first_name = :firstname, street = :street, city = :city, postal_code = :postalCode, date_of_birth = :dateOfBirth, nationality = :nationality, gender = :gender, telephone = :telephone, mobile = :mobile, hasRoomForRent = :hasRoomForRent, isIaesteMember = :isIaesteMember, hasMadeTraineeship = :hasMadeTraineeship, dataIsApproved = :dataIsApproved '.((isset($password) && $password != 'password')? ',password = :password': '').' WHERE email = :email');
$stmt->bindParam(':dateOfBirth', $DateOfBirth);
$stmt->bindParam(':nationality', $nationality);
$stmt->bindParam(':gender', $gender);
$stmt->bindParam(':telephone', $telephone);
$stmt->bindParam(':mobile', $mobile);
这是用户类
class User {
private $email;
private $firstname;
private $name;
private $street;
private $city;
private $postalCode;
private $dateOfBirth;
private $nationality;
private $gender;
private $telephone;
private $mobile;
...
public function getNationality() {
return $this->nationality
...;
我真的不知道发生了什么事。字段的顺序似乎堆积起来有什么问题?