的index.phpMySQL的PHP的問題:儘管使用error_reporting(E_ALL)線
<html>
<head>
<title>Josh's Online Playground</title>
</head>
<body>
<form method="POST" action="action.php">
<table>
<tr>
<td>"data for stuff"</td>
<td><input type="text" ?></td>
</tr>
<tr>
<td><input type="submit"></td>
</tr>
</table>
</form>
</body>
</html>
action.php的
<?php
error_reporting(E_ALL);
ini_sit("display_errors", 1);
$mysqli = new mysqli('localhost', 'root', 'password', 'website');
$result = $mysqli->query("insert into stuff (data) values ('
.$_POST['data']
."');
echo $mysqli->error();
if($result = $mysqli->query("select data from stuff")){
echo 'There are '.$result->num_rows.' results.';
}
while ($row = $result->fetch_object()){
echo 'stuff' . $row->data;
}
?>
儘管action.php的前兩行沒有錯誤消息,我沒有得到任何錯誤或警告消息。 相反,點擊提交按鈕後,我會看到一個空白頁面。
我是否必須以不同的方式插入數據?
我修正了這個問題。但仍然沒有結果。該行現在讀取: $ result = $ mysqli-> query(「insert into stuff(data)values('」。$ _POST ['data']。「')」; – lowerkey 2010-06-15 11:00:16
養成了使用編輯器的習慣語法突出顯示,並且查看諸如此類的錯誤變得更加容易......如果您查看原始發佈內容,即使在那裏也很明顯。 – 2010-06-15 11:05:17