What basic pieces am I missing? No data to table from Server Side

What basic pieces am I missing? No data to table from Server Side

RNickRNick Posts: 2Questions: 0Answers: 0
edited December 2011 in General
What am I missing?
I would be willing to pay the $50, but it says they don't help with the server side, and I can't even get passed using the default server_processing.php script. I've only added my DB and login info, and init the table in the example pg which is now my WP php page. If I put an integer in $sIndexColumn in the server side script page, it will populate the table with numbers and 10,000 rows(which is the # of rows in my MySQL table) so I know it's connecting to the database, just running into json parsing errors and I have done nothing but add my DB and connection info. I saw other threads of people with this json parsing problem on line 1, no real answers. I tried another table, no go. I wrote my own query and array into the same table, it loads no problem, but it's loading all records into DOM. And I want to server side filter 3 custom fields to their respective 3 cols. Maturity, Yield. Date. Muni Bonds Listings.

Error:
"DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error."
Console:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
FROM bond_listings' at line 1"

The server_processing.php doc and php page uploaded, MySQL server table is there with same # of col as MySQL table. Hosting is your standard shared server. Standard config apache. My attempt with my own script, Mysql/php code loads the table/cols, "while" rows array, into a the same table no problem, but that's loading all 10,000 rows/15col into DOM.

Server_processing.php file with no unusual hacks etc. just db and connection info:

/* Array of database columns which should be read and sent back to DataTables. Use a space where
* you want to insert a non-database field (for example a counter or static image)
*/
$aColumns = array( '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15');

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

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

/* Database connection information */
$gaSql['user'] = "foo";
$gaSql['password'] = "Money";
$gaSql['db'] = "SiteDB";
$gaSql['server'] = "localhost";
-----------------------------------------------------------
example pg(my Bonds Listings pg) nothing altered from example but the additions to init, sorting on a col and added the additional rows to accept the data, am I missing somthing? :

$(document).ready(function() {
$('#datatables').dataTable( {
"bProcessing": true,
"bServerSide": true,
"bRetrieve": true,
"sDom": 'iplrtip',
"bInfo": true,
"aaSorting": [[ 5, 'asc' ]],
"bAutoWidth": false,
"bJQueryUI":true,
"sPaginationType": "full_numbers",
"sAjaxSource": "http://www.site.com/wp-content/themes/themefolder/scripts/server_processing.php",

} );
} );




Issue
State
Moody Rating
S&P Rating
Coupon
Maturity
First Call
Call Price
Next Call
Settlement
Category
Cur Yld
Offer Quantity
Offer Yield
Offer Price























Issue
State
Moody Rating
S&P Rating
Coupon
Maturity
First Call
Call Price
Next Call
Settlement
Category
Cur Yld
Offer Quantity
Offer Yield
Offer Price





Link: http://www.firstky.com/municipal-finance/get-bonds-listings/bonds-listings/
The numbers in the cells is due to $sIndexColumn = "1";

This is as basic as it gets without the custom input filter fields, server side filtering which I also need to figure out, etc.

I saw other threads, other people having these issues but no resolution, can anyone shed any light?

Thanks in advance.
Randy

Replies

  • GregPGregP Posts: 500Questions: 10Answers: 0
    On the link provided, I don't see a JSON error. I'm not sure if you're making headway and that's why it's working or if it's due to that page using your while loop (instead of a DB connection).

    Certainly with the PHP, you will want to log the contents of the variable after converting with the method that conversts to JSON. Then on the client side, even though it's saying there is error, the console should still let you inspect the response. It's this second part I wanted to do, but alas the JSON error isn't appearing on the sample link.
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    you'll need to specify a $sIndexColumn in order for the "total data set length" query to run

    [code]
    $sQuery = "
    SELECT COUNT(".$sIndexColumn.")
    FROM $sTable
    ";
    [/code]

    this will generate a db syntax error if $sIndexColumn is empty string.

    since your page seems to be working, you probably already fixed this.
This discussion has been closed.