Server-side implementation problems
Server-side implementation problems
First, thanks for the amazing script. It couldn't be more exactly what I want.
I'm using it here- http://sroeco.com/solar/table/
However, being a php/ mysql novice, I've had trouble rendering the table with server-side processing. The table you see is 'ghetto code' not actually reading for my mySql database.
So, hopefully a simple fix - I need to know how to connect my server_processing.php with my table.html so that the table will populate with the data from the server instead of from the static code I've written into the current file.
Here are (what I believe) are the relevant codes:
First where I think my problem probably is... table.html Does the table id (id='tblMain') tell the script to populate it with the data?
[code]
Manufacturer
ID
Rating
Efficiency
Loading data from server...
[/code]
And here is the javascript in my table.html
[code]
$(document).ready(function() {
$('#tblMain').dataTable( {
"bPaginate": true,
"bJQueryUI": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "http://sroeco.com/solar/table/server_processing.php",
"sPaginationType": "full_numbers",
"aaSorting": [[ 3, "desc" ]],
"aoColumns": [
{ "asSorting": [ "asc", "desc" ] },
{ "asSorting": [ "desc", "asc" ] },
{ "asSorting": [ "desc", "asc" ], "sType": "numeric" },
{ "asSorting": [ "desc", "asc" ], "sType": "numeric" }
]
} );
} );
[/code]
I apologize in advance if it's a simple fix.
Thanks,
Shawn
I'm using it here- http://sroeco.com/solar/table/
However, being a php/ mysql novice, I've had trouble rendering the table with server-side processing. The table you see is 'ghetto code' not actually reading for my mySql database.
So, hopefully a simple fix - I need to know how to connect my server_processing.php with my table.html so that the table will populate with the data from the server instead of from the static code I've written into the current file.
Here are (what I believe) are the relevant codes:
First where I think my problem probably is... table.html Does the table id (id='tblMain') tell the script to populate it with the data?
[code]
Manufacturer
ID
Rating
Efficiency
Loading data from server...
[/code]
And here is the javascript in my table.html
[code]
$(document).ready(function() {
$('#tblMain').dataTable( {
"bPaginate": true,
"bJQueryUI": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "http://sroeco.com/solar/table/server_processing.php",
"sPaginationType": "full_numbers",
"aaSorting": [[ 3, "desc" ]],
"aoColumns": [
{ "asSorting": [ "asc", "desc" ] },
{ "asSorting": [ "desc", "asc" ] },
{ "asSorting": [ "desc", "asc" ], "sType": "numeric" },
{ "asSorting": [ "desc", "asc" ], "sType": "numeric" }
]
} );
} );
[/code]
I apologize in advance if it's a simple fix.
Thanks,
Shawn
This discussion has been closed.
Replies
[code]
<?php
$gaSql['user'] = "";
$gaSql['password'] = "";
$gaSql['db'] = "";
$gaSql['server'] = "";
$gaSql['type'] = "mysql";
$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'] ) )
{
$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]
For the table ID, that is only used for the jQuery selector - DataTables doesn't actually use it internally (it does stick it on a few created elements for easy styling if you want, but nothing processing wise).
Allan
The new script looks promising though, so I might play with it until I get that to work, too.
Thanks,
Shawn