We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38009
    • 7 Posts
    Hi,

    I am using EasyNewsletter module and after upgrading to MODx 1.2.1 today I started receiving warnings like this:

    mysql_result() expects parameter 1 to be resource, object given in

    I've found that the invocation of mysql_result in the code below doesn't work.

    $sql = "SELECT * FROM `easynewsletter_config` WHERE `id` = 1";
    $result = $modx->db->query($sql);
    include($path.'languages/'.mysql_result($result,$i,"lang_backend").'.php');
    


    In the result there are further errors as the function does not return anything and MODx is trying to include ".php" file instead of "polish.php".

    What could be a problem? How to solve that? I need to fix that ASAP and at this moment I don't have a clue how to do that. Any help appreciated.

    PS: I know EasyNewsletter is a old solution but I hope it would be easy to fix it.

    Thanks
    Greg

    This question has been answered by iusemodx. See the first response.

      • 40706
      • 128 Posts
      all mysq_* functions should be converted in the current modx 1.2, there were some PHP7 compatibility changes.

      use $modx->db->getRow( $result ) instead

      $sql = "SELECT * FROM `easynewsletter_config` WHERE `id` = 1";
      $result = $modx->db->query($sql);
      include($path.'languages/'.$modx->db->getRow( $result )["lang_backend"].'.php');
      


      • discuss.answer
        • 13226
        • 953 Posts
        A possible temporary solution is to change the database type in the config.inc

        In "manager/includes/config.inc.php"

        Change:

        $database_type = 'mysqli';


        TO

        $database_type = 'mysql';


        IMPORTANT

        This is a temporary solution and should only be seen as such - this will probably give you time to get EasyNewsletter updated to use "mysqli" functions instead of the deprecated "mysql" functions.
          • 38009
          • 7 Posts
          Hi,

          Thanks for both answers. First I temporarily changed database type to "mysql" (which worked fine!) to have some time to handle the old EasyNewsletter plugin&snippet changes.

          Thx!
          Greg