php - mysql php问题: no error message despite error_reporting(E_ALL) line

标签 php mysql

索引.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;
  }
?>

除了 action.php 中的前两行,我没有收到任何错误或警告消息。 相反,我在点击提交按钮后得到了一个空白页面。

我是否必须做一些不同的事情来插入数据?

最佳答案

你在 action.php 中有一个语法错误:

ini_set 不是 ini_sit 第 2 行!

关于php - mysql php问题: no error message despite error_reporting(E_ALL) line,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3044431/

相关文章:

php - 返回数据库的下一个图像

javascript - 在 WooCommerce 单个产品页面上专门加载脚本

php - jquery ajax 调用从 MySql 表中设置选择选项

php - MySQL:Select LIKE 无法正常工作

mysql - 带排序的 SQL 查询

mysql - 来自多个数据库的 INNER JOIN 上的未知字段

php - 我需要理解类(class)

php - 哪些 php 框架最适合与 Cassandra 等 NoSQL 数据库一起使用?

mysql - 如何根据不同的id从同一个表中获取公共(public)记录?

mysql - 具有条件 db_or 等的 Drupal 7 DB API 查询