MySQL PHP
MySQL PHP
I am completely new to jquery and this plugin looks like everything I have been looking for. I have been using SPRY, but I have a large dataset and it takes forever to load. My question is what is the syntax to call and display columns from MySQL. I have created a php file to connect to MySQL and display my table. How do I call that file and then call those rows in the table? I would greatly appreciate any help. Thanks.
This discussion has been closed.
Replies
Have you seen the server-side processing example that DataTables 1.5 (beta) comes with? http://datatables.net/1.5-beta/examples/data_sources/server_side.html It sounds like this might help you in your quest...
Regards,
Allan
I'm not quite sure what you mean by the syntax for each table column? Each table column is just a string in a Javascript array. If you have a look at how my script is passing data around, this might help (Firebug will also help, given that it shows what is actually passed around). Also this post might be of some use, detailing what data is passed to the server, and from it: http://datatables.net/forums/comments.php?DiscussionID=53 . Full documentation for that will be available soon.
Regards,
Allan
[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
DataTables example
@import "../../media/css/demo_page.css";
@import "../../media/css/demo_table.css";
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "../examples_support/server_processing.php"
} );
} );
DataTables server-side processing example
Customer_Ticket_No
Loading data from server
Customer_Ticket_No
[/code]
What can I change in this to see my data?
A couple of things from this then:
1. You've included jQuery twice (this is my fault - my demo code has this as well - I think I've corrected them all now though)
2. You only have one column (the th) so if you have more than one column of information returned from the server it will reject it - the columns much match in the HTML and the server return.
3. You have a colspan=5 but only one column!
Regards,
Allan
[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
DataTables example
@import "../../media/css/demo_page.css";
@import "../../media/css/demo_table.css";
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "../examples_support/server_processing.php"
} );
} );
DataTables server-side processing example
Customer_Ticket_No
Loading data from server
Customer_Ticket_No
[/code]
[code]
<?php
/* MySQL connection */
include( $_SERVER['DOCUMENT_ROOT']."/Connections/datatables.php" ); /* ;-) */
$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]
Regards,
Allan
Regards,
Allan
[code]
I am still only getting the "Loading data from server".
[/code]