【问题标题】:Fatal Error while setting up DataTables Editor设置数据表编辑器时出现致命错误
【发布时间】:2020-03-23 01:31:04
【问题描述】:

我正在使用 DataTables API 构建一个 CRUD 应用程序并尝试设置编辑器。在 DataTables 团队的帮助下,我能够部分完成设置过程,但 Editor 没有将任何记录从我的数据库中提取到 DataTables 中。他们提到我需要更新 config.php 文件,其中包含连接到数据库所需的信息。当我更新它时,我看到了这个:

Fatal error: Uncaught Error: Call to a member function transaction() on string in C:\xampp\htdocs\ccrp\api\lib\Editor.php:964 Stack trace: #0 C:\xampp\htdocs\ccrp\api\lib\Editor.php(700): DataTables\Editor->_process(Array) #1 C:\xampp\htdocs\ccrp\api\server_data.php(53): DataTables\Editor->process(Array) #2 {main} thrown in C:\xampp\htdocs\ccrp\api\lib\Editor.php on line 964

我不确定这个错误是什么意思或如何修复它。 DataTables 团队说这可能与我更新的 config.php 文件有关,所以这是我当前的配置文件:

<?php if (!defined('DATATABLES')) exit(); // Ensure being used in DataTables env.

/*
 * DB connection script for Editor
 * Created by http://editor.datatables.net/generator
 */

// Enable error reporting for debugging (remove for production)
error_reporting(E_ALL);
ini_set('display_errors', '1');

/*
 * Edit the following with your database connection options
 */
$sql_details = array(
    "type" => "Mysql",
    "user" => "root",
    "pass" => "",
    "host" => "localhost",
    "port" => "",
    "db"   => "ccrp_db",
    "dsn"  => "charset=utf8"
);

?>

【问题讨论】:

标签: php jquery mysql datatables jquery-datatables-editor


【解决方案1】:

我解决了。对于其他也遇到此问题的人,请确保在从 Editor 生成的实例构造函数中包含 $db 变量。

【讨论】:

    猜你喜欢
    • 2013-11-17
    • 1970-01-01
    • 1970-01-01
    • 2016-08-20
    • 1970-01-01
    • 2023-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多