Problem with IE. No records.

Problem with IE. No records.

krunoslavkrunoslav Posts: 6Questions: 0Answers: 0
edited April 2009 in General
I have a mysql/php connection in Datatable sample and everything works fine with Firefox. Records are displayed properly. But, the same page on IE give me a message 'Nothing found' (sZeroRecords).

Has somebody idea what would be a problem?

Replies

  • Luda AmebaLuda Ameba Posts: 11Questions: 0Answers: 0
    Hi,
    How do you pass data from server, I mean do you use something like this
    var tableData = eval( '(' + rowsFromServer + ')' );
    before sending it to table, in my case the '(' ')' do the work for IE :)
  • krunoslavkrunoslav Posts: 6Questions: 0Answers: 0
    Thanks for quick response.
    I'm not sure about passing. This is a PHP code:

    $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
  • allanallan Posts: 63,578Questions: 1Answers: 10,483 Site admin
    Might you have any non-escaped characters in your json output (for example a ' in one of the columns would break it)? It would be worth running your json output through a json validator: http://www.jsonlint.com/

    Allan
  • Luda AmebaLuda Ameba Posts: 11Questions: 0Answers: 0
    while ( $aRow = mysql_fetch_array( $rResult ) )
    {
    $sOutput .= "[";
    $sOutput .= "'".$aRow['proizvod_naziv']."',";
    $sOutput .= "'".$aRow['proizvod_sifra']."',";
    $sOutput .= "'".$aRow['proizvod_model']."',";
    $sOutput .= "'".$aRow['proizvod_vpc_cijena']."',";
    $sOutput .= "],"; // there is the spot where you dont form data well, don`t add comma to last record from dbase :)
    }
  • krunoslavkrunoslav Posts: 6Questions: 0Answers: 0
    unfortunately, without this comma don't works in firefox , too :-(
  • Luda AmebaLuda Ameba Posts: 11Questions: 0Answers: 0
    did you used simething like this
    $i = 0;
    while ( $aRow = mysql_fetch_array( $rResult ) )
    {
    $i++;
    $sOutput .= "[";
    $sOutput .= "'".$aRow['proizvod_naziv']."',";
    $sOutput .= "'".$aRow['proizvod_sifra']."',";
    $sOutput .= "'".$aRow['proizvod_model']."',";
    $sOutput .= "'".$aRow['proizvod_vpc_cijena']."',";
    $sOutput .= "]";
    if($i < $iTotal)
    $sOutput .= ",";
    }
  • krunoslavkrunoslav Posts: 6Questions: 0Answers: 0
    Luda Ameba, Not works with this solution, too..

    Allan, sorry, how to get JSON output?
  • allanallan Posts: 63,578Questions: 1Answers: 10,483 Site admin
    @Luda - the line "$sOutput = substr_replace( $sOutput, "", -1 );" will remove the last comma - so I don't think that is the problem here.

    @krunoslav - to get the json output - the easiest way is using something like Firebug... But since you are using IE, what you can do is load the server_processing.php page in your web-browser (remember to add the relavant GET variables, and it will pop up in your browser.

    Do you have a link you can provide?

    Allan
  • Luda AmebaLuda Ameba Posts: 11Questions: 0Answers: 0
    @Allan
    True, I wasn’t paying enough attention. :)

    There is lite version of firebug that can be run under IE :)
    http://getfirebug.com/lite.html
  • krunoslavkrunoslav Posts: 6Questions: 0Answers: 0
    @Allan

    there is a link:
    http://www.pramat.hr/admin/prodaja/grid4/examples/examples_support/server_processing.php

    strange thing is that when you click on third column records displayed, but when you click on first and second column they gone
  • allanallan Posts: 63,578Questions: 1Answers: 10,483 Site admin
    Hi krunoslav,

    Thanks for the link - your json is definitely not valid which is what is causing you issues. There are a couple of problems:

    1. The number of entries in the array changes from between 4 and 6
    2. They are not escaped
    3. There is a missing quote mark on one of the columns.

    Try altering your server-side code so that it does parse correct json.

    Regarding the third column, it suspect that this is just luck - the server is outputting valid json at this point because the ten rows it is limited to happen not to have the problems mentioned above.

    Allan
  • krunoslavkrunoslav Posts: 6Questions: 0Answers: 0
    Hi Allan,
    This is definitely cause of my problems.
    Thank you for your efforts and for great software too...

    Luda Ameba,
    thanks for your help , too
This discussion has been closed.