DataTables Error Message

DataTables Error Message

BreezwellBreezwell Posts: 3Questions: 0Answers: 0
edited September 2011 in DataTables 1.8
First off, let me just say that this is an amazing piece of software. Maybe more impressive is the willingness to share such a gem with those of us who would never be able to create such a tool.

I see that my question has been 'kinda' answered in another post, however my implementation (probably very clunky) is working occasionally and is easy for me to maintain. I am getting the following error message:

DataTables: warning (table='example'): Requested unknown parameter '3' from data source for row 65.

Now, at one point I got this and figured the php.ini post_max_size variable was not set high enough. I changed this to a much higher value and the error message stopped. I took this to mean the code simply did not have enough time to finish and render the page (table). This seemed to work, but now, for whatever reason, the error is returning. The following is my (don't laugh) code I am using to run numerous queries which create my table:

// DataTables Header
echo "Flavor FamilyUBRUSUBR%US%";

For ($x=0; $x<=$arrayFamilyLength; $x++) {

// Total Projects
//$sqlTotalProjects = mysql_query("SELECT DISTINCT OPPORTUNITY_ID FROM omsamples");
//$TotalProjectCount = mysql_num_rows($sqlTotalProjects);


// Unique Sample Submissions Per Flavor Family
// $sqlBRCounts = mysql_query("SELECT DISTINCT BRID, SRFlavorFamily FROM data WHERE SRFlavorFamily ='" . $familyArray[$x] . "'" . "");
$sqlBRCounts = mysql_query("SELECT DISTINCT OPPORTUNITY_ID, FLAVOR_FAMILY FROM omsamples WHERE FLAVOR_FAMILY = '" . $familyArray[$x] . "'" . "");
$BRCount = mysql_num_rows($sqlBRCounts);
echo "" . $familyArray[$x] . "" . $BRCount . "";


// Unique Business Requests Per Sample Flavor Family
// $sqlSampleFamilyCounts = mysql_query("SELECT DISTINCT SRGroupCode, SRFlavorFamily FROM data WHERE SRFlavorFamily ='" . $familyArray[$x]. "'" . "");
$sqlSampleFamilyCounts = mysql_query("SELECT DISTINCT PRODUCT_CODE, FLAVOR_FAMILY FROM omsamples WHERE FLAVOR_FAMILY = '" . $familyArray[$x] . "'" . "");
$SampleFamilyCount = mysql_num_rows($sqlSampleFamilyCounts);
echo "" . $SampleFamilyCount;

// End Table Rows
echo "";
}
echo "";
echo "";

The For Loop simply iterates over an array of text and used them as query value specified by $familyArray[$x]. The array basically looks like this:

$familyArray = array("Lemon","Blueberry", "Mint");

This array has around 100 indexed words.

Any ideas why this code would not work?

Thanks and let me know if my details are insufficient.

Brian

Replies

  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin
    [quote]Breezwell said: DataTables: warning (table='example'): Requested unknown parameter '3' from data source for row 65.
    [/quote]

    This error means that DataTables can't find the TD element (index 3 - i.e. the fourth one) for row 65. I assume you are reading it from the DOM, so it suggests that the table is incomplete. If you don't run DataTables does the table look okay and does the page validate?

    Allan
  • BreezwellBreezwell Posts: 3Questions: 0Answers: 0
    Allan

    The table looks great after disabling DataTables initialization.

    Funny thing is all the data loads, but the error happens when the page first loads and any sorting or filtering is applied. Validation is good-to-go as well. The whole timeout issue with page loading does not seem to be the issue as all the data loads.

    Thanks for the follow up.

    Brian
  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin
    Sounds interesting... Can you give me a link to the page so I can perhaps see what is happening? If you don't want to make the link public you can send me a private message by clicking on my name and then "Send allan a Message".

    Regards,
    Allan
  • BreezwellBreezwell Posts: 3Questions: 0Answers: 0
    Allan

    So, I spent some time taking a closer look at the code I was using to generate my html table. I managed to get everything working, but here is a breakdown of what I had to address in order to rectify the issues I was having. I will post this for others as a reference as it has nothing to do with DataTables and may frustrate someone else new to PHP.

    1. I have a PHP For loop that I use to iterate over an array of flavor names which are used to provide the keyword in numerous sql queries. The parameters I used to set up the array was not done optimally and was generating offset errors. The proper way to set up the loop is:

    $flavorArray = array("Lemon","Orange","Grape");
    For ($x=0; $x < count($flavorArray); $x++)

    I was not using the count() function to iterate and this was creating a bogus count which I think contributed to the error I was getting.

    2. I noticed that when I provided elements but did not subsequently populate elements under them, the page did not load properly either. This could be because the page did not do a true reload after fixing issue 1, but it was something I noticed so I am posting 'just in case'.

    Thank you for your assistance and willingness to work with me on this further. I am really looking forward to leveraging this software in my current work.

    Brian
  • allanallan Posts: 63,368Questions: 1Answers: 10,449 Site admin
    Hi Brian,

    Thanks for the feedback and great to hear you got it working :-)

    Allan
This discussion has been closed.