We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6228
    • 249 Posts
    Those errors lead me to belive that you actually are connected to your remote database.

    Two things you might try is moving the [tt]mysql_close($link)[/tt] statement to the end of the script, right before the return statement, and uncomment it. Prematurely closing the database connection may be inadvertently destroying the resource result set.

    Another thing, which will probably make no difference but worth trying, is change your mysql_connect to [tt]mysql_connect($host,$uid,$pwd, TRUE) [/tt]. That forces a new mysql connection, but is really only useful for opening new connections on identical database credentials.
      lo9on.com

      MODx Evolution/Revolution | Remote Desktop Training | Development
      • 813 ☆ A M B ☆
      • 326 Posts
      Nope. I tried both of your suggestions (separately and in tandem), but I get the same errors.

      I should probably clarify: this IS working. The dropdown is being generated, and I can see the names and values. They save as expected. I just also happen to have those two errors at the bottom of the page. I guess I can just tell the client to overlook them, but that’s pretty shoddy. Think it’s worth submitting a bug report? I have a feeling this is a problem with @EVAL that was introduced in 1.0.5.
        • 813 ☆ A M B ☆
        • 326 Posts
        My other thought was to set up a cronjob separately from MODx that runs every few minutes, queries the external table and generates an identical table in my MODx database. That would eliminate the need for this connection mess, but for obvious reasons, I’d prefer not to resort to this level of complexity.
          • 18913
          • 654 Posts
          Here’s my setup :

          Template variable is called extdbtv
          Input type : Listbox (Single-Select)
          Input Option Values : @EVAL return $modx->runSnippet(’testsnippet’);

          Testsnippet code : as above except that real passwords, userinfo, etc. used;

          Screen appearance with "mysql_close" left in : tv2.jpg

          PHP Version 5.3.0
          MySQL Client API version 5.1.37
          MODx version 1.0.5
          Database Version 5.1.37
          Database Charset utf8
          Database Collation Charset utf8_unicode_ci

          EDIT : This is running on XAMPP for Windows 1.7.2 (on 64-bit Vista, Dell Inspiron laptop), Apache 2.0, FireFox 4.0
          When I comment out "mysql_close", I do not get any error messages shown.

          Matt