Cannot use object of type stdClass as array in ................ PHP 5.5.37

Cannot use object of type stdClass as array in ................ PHP 5.5.37

melphmelph Posts: 37Questions: 1Answers: 0

Hi

I have been using data Tables for years on my website - runs brilliantly. That was until this week when my webhost upgraded php to 5.5.32. Now I get Cannot use object of type stdClass as array in on any page that uses data tables.

I dont even know where to start looking for this - is there someone who could point me in the right direction?

The error line (Cannot use object of type stdClass as array in line ..................... on line .....), the line number is always at the point where the datatable would be drawn if that makes sense. So all headers, menus and other PHP stuff fine.

Thanks

Mark

This question has an accepted answers - jump to answer

Answers

  • melphmelph Posts: 37Questions: 1Answers: 0

    OK - spent about 8hrs on this and have gone through and changed all mysql requests to mysqli - seems like original error may or may niot have been to do with datatables as removing some further code of the page got rid of the error.

    Im stuck now with the error Warning:
    mysqli_query() expects at least 2 parameters, 1 given in

    Im using the DTEditor.mysql.class.php. I have updated this so all references to mysql are now mysqli

    when building the query the code is
    $sql =

             "SELECT ".implode(", ", $fields)."
    
             FROM {$this->_table} WHERE DATE_SUB(CURDATE(),INTERVAL 7 DAY) <= results.`date` ORDER BY results.`date` DESC";
    
        $res = $this->_execute( $sql );
    
        if ( ! $res ) {
    
            return;
    

    I have added some info to limit the data returned (and this has worked fine) - it seems mysqli needs the $db connection data to e added here "($db,SELECT ".implode(", ", $fields).".....................) as in theory it now has the missing data listed in the error, but when i run the code, this then states undefined variable $db, even if I do define it on the page.

    Im stuck

  • allanallan Posts: 61,664Questions: 1Answers: 10,095 Site admin
    Answer ✓

    DTEditor.mysql.class.php

    That's a very old version of Editor (1.3 perhaps?). Can you upgrade to the current release please (1.5.6)? The download is available here.

    Allan

  • melphmelph Posts: 37Questions: 1Answers: 0

    Hi Allan

    Thanks for to the reply. I have got it to work now so will be OK. As for upgrade, I have over the years customised pages so much I'm afraid of what might stop working after r an upgrade.

    Anyway, thanks Allan, still a great product!

    Mark.

This discussion has been closed.