我試圖更新mysql表中的列值,但沒有任何事情發生。更新mysql行不工作
它既不顯示更新消息也不顯示錯誤消息。
HTML表單:
<html>
<form action='xyz.php' method='post'>
<input type='text' size='25' id='country' name='country'>
<input type='submit' id='submit' value='update'>
</form>
</html>
PHP代碼:
<?php
session_start();
$con=mysqli_connect("localhost","root","","server2go");
if(mysqli_connect_errno())
echo "<h2>Failed to connect to MySQL database!".mysqli_connect_errno();
if(isset($_POST['submit'])){
$country=$_POST['country'];
$userid=987654326;
$sql2=mysqli_query($con, "UPDATE user_profile set country='$country' WHERE userid='$userid'");
if(!$sql2){
die(mysqli_error($con));
echo "<h6>Failed to update</h6>";
}
else {
echo "<h5>Successfully updated!</h5>";
}
}
?>
我做了什麼錯在這裏?
plz help。
你收到任何錯誤訊息留在生產時的錯誤報告? – Jens 2014-10-30 07:24:02