mysql php problem: no error message despite error_reporting(E_ALL) line
Posted
by herrturtur
on Stack Overflow
See other posts from Stack Overflow
or by herrturtur
Published on 2010-06-15T10:49:26Z
Indexed on
2010/06/15
10:52 UTC
Read the original article
Hit count: 186
index.php
<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;
}
?>
Despite the first two lines in action.php, I get no error or warning messages. Instead I get a blank page after clicking the submit button.
Do I have to do something differently to insert data?
© Stack Overflow or respective owner