MySQL PHP

MySQL PHP

sonytasonyta Posts: 3Questions: 0Answers: 0
edited August 2010 in General
I used datatables for display my data from server but I have a large data, so i used server-side processing example with hidden row information. My question is how can we connect to server "mysql" and display columns from MySQL. I have created a php file to connect to MySQL and display my table. but I am still only getting the "Loading data from server", this file below correct or not? I would greatly appreciate any help.

Regards.

Replies

  • sonytasonyta Posts: 3Questions: 0Answers: 0
    [code]
    <?php
    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    * Easy set variables
    */

    /* Array of database columns which should be read and sent back to DataTables */
    $aColumns = array( 'engine', 'browser', 'platform', 'version', 'grade' );

    /* Indexed column (used for fast and accurate table cardinality) */
    $sIndexColumn = "id";

    /* DB table to use */
    $sTable = "infos";

    /* Database connection information */
    $gaSql['user'] = "root";
    $gaSql['password'] = "";
    $gaSql['db'] = "test";
    $gaSql['server'] = "localhost";

    $gaSql['link'] = mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password'] ) or
    die( 'Could not open connection to server' );

    mysql_select_db( $gaSql['db'], $gaSql['link'] ) or
    die( 'Could not select database '. $gaSql['db'] );

    /* Paging */
    $sLimit = "";
    if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
    {
    $sLimit = "LIMIT ".mysql_real_escape_string( $_GET['iDisplayStart'] ).", ".
    mysql_real_escape_string( $_GET['iDisplayLength'] );
    }

    /* Ordering */
    if ( isset( $_GET['iSortCol_0'] ) )
    {
    $sOrder = "ORDER BY ";
    for ( $i=0 ; $i
    [/code]
This discussion has been closed.