我嘗試了一個小程序來通過PHP在MySQL中插入數據,但沒有任何反應。它既不會給出錯誤,也不會插入數據。無法理解問題在哪裏?PHP不插入數據到MYSQLi
<?php
$database=mysqli_connect("localhost","root","","aaa")or die('Localhost Connection Problem');
$xyz=mysqli_select_db($database,"aaa");
if(isset($_POST['submit']))
{
$dlqty=$_POST['dlqty'];
$slqty=$_POST['slqty'];
$price=$_POST['price'];
$ins=mysqli_query($database,"insert into bbb (dlqty,slqty,price) values ('$dlqty','$slqty','$price')");
mysqli_close($database);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form name="eee" method="post">
<input type="text" name="dlqty" />
<input type="text" name="slqty" />
<input type="text" name="price" />
<input type="button" name="submit" value="submit" />
</form>
</body>
</html>
幫助將不勝感激。
你得到任何錯誤或警告? – Akshay
顯示這些錯誤的唯一方法是修改你的php.ini這一行: 的display_errors =上 –
沒什麼,沒有錯誤,而不是插入 – Ronit