http://datatables.net/tn/7

http://datatables.net/tn/7

zezooooozezooooo Posts: 12Questions: 1Answers: 0
edited December 2018 in Free community support

staff.php is not found (error 404)
the path is correct and i edited config.php
and the problem is still
the project is here is google drive
https://drive.google.com/drive/folders/1YRqifiPNuMzgT6sySoKs_fBGheUre2sz?fbclid=IwAR0dUqDGFsJkoTN5utZIYuSgglFu78CT4bnoGYTUARNGrx2pTV-pOPi6sf8
staff.php

[code]
<?php

/*
 * Example PHP implementation used for the index.html example
 */

// DataTables PHP library
include( "../lib/DataTables.php" );

// Alias Editor classes so they are easy to use
use
    DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\Mjoin,
    DataTables\Editor\Options,
    DataTables\Editor\Upload,
    DataTables\Editor\Validate,
    DataTables\Editor\ValidateOptions;

// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'students' )
    ->fields(
        Field::inst( 'name' )
            ->validator( Validate::notEmpty( ValidateOptions::inst()
                ->message( 'A first name is required' ) 
            ) ),
        Field::inst( 'std_code' )
            ->validator( Validate::notEmpty( ValidateOptions::inst()
                ->message( 'A code is required' )  
            ) ),
        Field::inst( 'id_num' ),
        Field::inst( 'birth_date' )
            ->validator( Validate::dateFormat( 'Y-m-d' ) )
            ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
            ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ),
        Field::inst( 'address' ),
        Field::inst( 'phone' ),
        Field::inst( 'enroll_date' )
            ->validator( Validate::dateFormat( 'Y-m-d' ) )
            ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
            ->setFormatter( Format::dateFormatToSql('Y-m-d' ) )
            
    )
    ->process( $_POST )
    ->json();
[/code]

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

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


/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Database user / pass
 */
$sql_details = array(
    "type" => "Mysql",     // Database type: "Mysql", "Postgres", "Sqlserver", "Sqlite" or "Oracle"
    "user" => "root",          // Database user name
    "pass" => "",          // Database password
    "host" => "localhost", // Database host
    "port" => "",          // Database connection port (can be left empty for default)
    "db"   => "fac_sys",          // Database name
    "dsn"  => "charset=utf8mb4",          // PHP DSN extra information. Set as `charset=utf8mb4` if you are using MySQL
    "pdoAttr" => array()   // PHP PDO attributes array. See the PHP documentation for all options
);


// This is included for the development and deploy environment used on the DataTables
// server. You can delete this block - it just includes my own user/pass without making 
// them public!
if ( is_file($_SERVER['DOCUMENT_ROOT']."/datatables/pdo.php") ) {
    include( $_SERVER['DOCUMENT_ROOT']."/datatables/pdo.php" );
}
// /End development include

[/code]

Replies

  • zezooooozezooooo Posts: 12Questions: 1Answers: 0

    should i make json file ??
    if it should , what should i do??

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947
    edited December 2018

    staff.php is not found (error 404)

    This is an error returned by the server. You will need to look at the server logs to see why its returning a 404 error. Maybe a permissions issue?

    Looks like your script is looking for a POST request. Do you have your Datatables ajax set for post like this example?
    https://datatables.net/examples/server_side/post.html

    Kevin

  • zezooooozezooooo Posts: 12Questions: 1Answers: 0

    thank you kevin

This discussion has been closed.