Add mysql Details on external file

Add mysql Details on external file

hiuufhiuuf Posts: 3Questions: 1Answers: 0
edited October 2018 in Free community support

I am using this code

<?php

/*
 * DataTables example server-side processing script.
 *
 * Please note that this script is intentionally extremely simply to show how
 * server-side processing can be implemented, and probably shouldn't be used as
 * the basis for a large complex system. It is suitable for simple use cases as
 * for learning.
 *
 * See http://datatables.net/usage/server-side for full details on the server-
 * side processing requirements of DataTables.
 *
 * @license MIT - http://datatables.net/license_mit
 */

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Easy set variables
 */

// DB table to use
$table = 'new';

// Table's primary key
$primaryKey = 'id';

// Array of database columns which should be read and sent back to DataTables.
// The `db` parameter represents the column name in the database, while the `dt`
// parameter represents the DataTables column identifier. In this case simple
// indexes
$columns = array(
    array( 'db' => 'name', 'dt' => 0 ),
    array( 'db' => 'country',  'dt' => 1 ),
    
    
);

require( 'mysql.php' );


); 

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * If you just want to use the basic configuration for DataTables with PHP
 * server-side, there is no need to edit below this line.
 */

require( 'ssp.class.php' );

echo json_encode(
    SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns )
);

and my mysql.php is this

$sql_details = array(
    'user' => 'root',
    'pass' => '123',
    'db'   => 'doo',
    'host' => 'localhost'


I don't know what i am missing

Thanks in advance for answer

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    Syntax error on line 41 in the server-side processing file.

    And also in the mysql.php file - missing that same ); at the end.

    Allan

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394

    I don't understand the question. What are you trying to do?

  • hiuufhiuuf Posts: 3Questions: 1Answers: 0

    I want to add mysql details via include file on server_processing.php

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin
    Answer ✓

    See my answer above please. Also refer to the server error logs which will be stating that you have a syntax error, in while it is and on what line.

    Allan

  • hiuufhiuuf Posts: 3Questions: 1Answers: 0

    PHP Parse error: syntax error, unexpected '?>', expecting ')' in C:\xampp\htdocs\mysql.php on line 9

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394

    Allan already told you how to fix your PHP file.

This discussion has been closed.