doucai1901 2014-07-07 13:16
浏览 30

PHP脚本仅在一个脚本上导致错误500,即使我评论所有内容

I get everytime Error 500. I tried to comment everything but nothing won't help. Where could be the problem? I use a normal apache2 server on Ubuntu. Even if I write the beginning tag like

<?php
error_reporting(E_ALL);

mysql_connect("192.168.3.64", "root", "xxx");
mysql_select_db("vertretung");

function rollback_if_error() {
    if(mysql_error()) {
        mysql_query("ROLLBACK");
        die("error");
    }
}

mysql_query("START TRANSACTION");

$table_id = rand();

mysql_query("INSERT INTO tables (table_id, table_date, table_name) VALUES ($table_id, '".mysql_real_escape_string($_POST['table_date'])."', '".mysql_real_escape_string($_POST['table_name'])."')");
rollback_if_error();

$table_rows = explode("|", $_POST['table_data']);

$is_caption = true;

foreach($table_rows as $row) {
    $row_id = rand();

    mysql_query("INSERT INTO table_rows (row_id, table_id, is_caption) VALUES ($row_id, $table_id, ".$is_caption.")");
    rollback_if_error();

    $fields = explode(";", $row);

    foreach($row as $field) {
        mysql_query("INSERT INTO table_field (row_id, value) VALUES ($row_id, '".mysql_real_escape_string($field)."')");
        rollback_if_error();
    }

    $is_caption = false;
}

mysql_query("COMMIT");
?>
  • 写回答

2条回答 默认 最新

  • ds355020 2014-07-07 13:22
    关注

    Generally error 500 occurred from server fault but sometime this issue came from php error not display. try this

    ini_set("display_errors","On");
    error_reporing(-1); // or E_ALL
    

    put this lines on top of the code.

    评论

报告相同问题?

悬赏问题

  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序