当我使用下面的查询时,它只会在新值比原来的值短时更新,有人知道这是为什么吗?
mysql_query("UPDATE users SET first_name='$first_name',
last_name='$last_name',
email='$email',
bio='$bio' WHERE id='$id'");
<?php
if(isset($_POST['update-profile'])){
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$bio = $_POST['bio'];
if(empty($bio) || empty($first_name) || empty($last_name) || empty($email)){
echo 'Please fill in all fields!';
} else {
mysql_query("UPDATE users SET first_name='$first_name', last_name='$last_name', email='$email', bio='$bio' WHERE id='$id'");
echo "Profile Updated";
header('location: pond.php');
}
}
?>
First Name: <br /><input type="text" name="first_name"></input><br /><br />
Last Name: <br /><input type="text" name="last_name"></input><br /><br />
Email Address: <br /><input type="email" name="email"></input><br /><br />
Bio: <br /><input type="text" name="bio"></input><br /><br />
<input type="submit" value="Update Profile" name="update-profile">
</div>
</div>