Trouble filtering server-side data
Trouble filtering server-side data
joshgateway
Posts: 9Questions: 0Answers: 0
Hi guys,
So I got server-side processing working and doing all I need it to do in my application with on exception, entering any text into the filter/search box crashes it. sProcessing is triggered and never goes away and nothing happens. I have my code below...any ideas on what could be causing this? (I have 'pushed extra data to the sender' which is all working well and giving me the desired result)
Initialization:
Server Side (PHP) code:
[code]
<?php
$aColumns = array('id', ' ', ' ', 'fname', 'lname', 'email_address', 'username', 'type_id', 'phone', 'profile_image',
'address1', 'address2', 'country', 'state', 'city', 'zipcode',
'shipping_address1', 'shipping_address2', 'shipping_country', 'shipping_state', 'shipping_city', 'shipping_zipcode');
/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "id";
/* DB table to use */
$sTable = "users";
/* Database connection information */
$gaSql['user'] = "gateway";
$gaSql['password'] = "picard!picard!";
$gaSql['db'] = "solomon-beta";
$gaSql['server'] = "us-west-2-mysql-vpc-instance1.c6ukgbmvu5lk.us-west-2.rds.amazonaws.com";
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
* no need to edit below this line
*/
/*
* MySQL connection
*/
$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 array()
);
// ChromePHP::log('whatttaaadfasfd');
while ( $aRow = mysql_fetch_array( $rResult ) )
{
$row = array();
for ( $i=0 ; $i
[/code]
THanks again for any help.
So I got server-side processing working and doing all I need it to do in my application with on exception, entering any text into the filter/search box crashes it. sProcessing is triggered and never goes away and nothing happens. I have my code below...any ideas on what could be causing this? (I have 'pushed extra data to the sender' which is all working well and giving me the desired result)
Initialization:
Server Side (PHP) code:
[code]
<?php
$aColumns = array('id', ' ', ' ', 'fname', 'lname', 'email_address', 'username', 'type_id', 'phone', 'profile_image',
'address1', 'address2', 'country', 'state', 'city', 'zipcode',
'shipping_address1', 'shipping_address2', 'shipping_country', 'shipping_state', 'shipping_city', 'shipping_zipcode');
/* Indexed column (used for fast and accurate table cardinality) */
$sIndexColumn = "id";
/* DB table to use */
$sTable = "users";
/* Database connection information */
$gaSql['user'] = "gateway";
$gaSql['password'] = "picard!picard!";
$gaSql['db'] = "solomon-beta";
$gaSql['server'] = "us-west-2-mysql-vpc-instance1.c6ukgbmvu5lk.us-west-2.rds.amazonaws.com";
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP server-side, there is
* no need to edit below this line
*/
/*
* MySQL connection
*/
$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 array()
);
// ChromePHP::log('whatttaaadfasfd');
while ( $aRow = mysql_fetch_array( $rResult ) )
{
$row = array();
for ( $i=0 ; $i
[/code]
THanks again for any help.
This discussion has been closed.
Replies
[code]
$(document).ready(function() {
var remove_perm = '<?= $admin_permissions ?>';
console.log('remove_perm: '+remove_perm);
if (remove_perm == 1) {
var aiex = [0];
} else {
var aiex = [0,2];
}
oTable = $('#test_main_list').dataTable( {
"sDom": 'C<"clearfix"f<"fll"l>>rtp',
"oColVis": {
"iOverlayFade": 200,
"aiExclude": aiex,
},
"bProcessing": true,
"bServerSide": true,
"sScrollY" : "405px",
"sScrollX" : "100%",
"bPaginate": false,
"sAjaxSource": ROOT + '_ajax/ss_get_users.php',
"aoColumns": [
/* id */ {"bVisible": false, "bSortable": false },
/* pic */ {"bSortable": false},
/* pic */ {"bVisible": false, "bSortable": false},
/* fname */ null,
/* lname */ null,
/* email */ null,
/* uname */ {"bVisible": false},
/* type */ null,
/* phone */ {"bVisible": false},
/* img */ {"bVisible": false, "bSortable": false},
/*Billing Address*/ {"bVisible": false },
/*Billing Address2*/ {"bVisible": false },
/*Billing City*/ {"bVisible": false },
/*Billing State*/ {"bVisible": false },
/*Billing Zip*/ {"bVisible": false },
/*Billing Country*/ {"bVisible": false },
/*Shipping Address*/ {"bVisible": false },
/*Shipping Address2*/{"bVisible": false },
/*Shipping City*/ {"bVisible": false },
/*Shipping State*/ {"bVisible": false },
/*Shipping Zip*/ {"bVisible": false },
/*Shipping Country*/ {"bVisible": false }
],
"fnServerData": function ( sSource, aoData, fnCallback ) {
/* Add some extra data to the sender */
aoData.push( { "name": "company_id", "value": "<?= $company_id ?>" } );
aoData.push( { "name": "term_admin", "value": "<?= $db->base_company->get_term('company') ?> admin" } );
aoData.push( { "name": "term_dep_admin", "value": "<?= $db->base_company->get_term('department admin') ?>" } );
aoData.push( { "name": "term_instructor", "value": "<?= $db->base_company->get_term('instructor') ?>" } );
aoData.push( { "name": "term_student", "value": "<?= $db->base_company->get_term('student') ?>" } );
$.getJSON( sSource, aoData, function (json) {
fnCallback(json)
} );
}
});
} );
[/code]
Anyone have any ideas :(
Can you link to a test case please.
Allan
Hi Allan, can I PM you a login?
Sure - click my forum user name and then the Message button.
Allan
```php
<?php
<?php > ``` ?>