请让我对这件事发疯。
我有这个表格:
echo "<input type='text' name='user_id' value='".$id."'' />";
echo "<tr><td>Emer</td><td><input type='text' name='first_name' value='".$rows['first_name']."' /></td></tr>";
echo "<tr><td>Mbiemer</td><td><input type='text' name='last_name' value='".$rows['last_name']."'' /></td></tr>";
echo "<tr><td>Mosha</td><td><input type='text' name='age' value='".$rows['age']."' /></td></tr>";
echo "<tr><td>Nr.Telefoni (Nr. i telefonit duhet te jete i formatit 06* ** *** **)</td><td><input type='text' name='phone' value='".$rows['phone']."' /></td></tr>";
echo "<tr><td>E-mail</td><td><input type='text' size='25' name='email' value='".$rows['Email']."' /></td></tr>";
echo "<tr><td>Qyteti</td><td><input type='text' size='25' name='city' value='".$rows['city']."' /></td></tr>";
echo "<tr><td>Shteti</td><td><input type='text' size='25' name='country' value='".$rows['country']."' /></td></tr>";
更新代码:
$first_name= $_POST['first_name'];
$last_name= $_POST['last_name'];
$mosha= $_POST['age'];
$phone=$_POST['phone'];
$email= $_POST['email'];
$city = $_POST['city'];
$country = $_POST['country'];
$id = $_POST['user_id'];
$query = "UPDATE users SET first_name = '$first_name',last_name = '$last_name',age = '$mosha',phone = '$phone',Email = '$email',country = '$country',city = '$city' WHERE user_id = '$id' ";
mysql_query($query) or die ("Error in query: $query");
;
如果我回应它,我会得到这个:
UPDATE users SET first_name = 'Al',last_name = 'M',age = '22',phone = '3545435345',Email = 'albana@al.com',country = 'Albania',city = 'Tirana' WHERE user_id = '1'
然后问题是,我回到拥有所有用户的页面,那里的电话号码显示完全不同的东西,就像一个固定号码。请帮助我哪里出错了!快把我逼疯了。
查询:
$sql='SELECT * FROM users WHERE Active = 1 AND user_id="'.$id.'"';
$result = mysql_query($sql) or die($sql."<br/><br/>".mysql_error());
电话号码为整数类型。