Help closing a MySQL connection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mainer82
    Senior Member
    • Apr 2003
    • 1285
    • 1.1.x

    Help closing a MySQL connection

    I have the latest version of Wordpress, I have it configured to call a custom footer.php file that works fine, but I'm attempting to query a number from a separate database and it's not working, here's the code:
    PHP Code:
    <?php
           
    include('/home/public_html/iedb/includes/config.php');
           
    // Request the text of all the info
           
    $query 'SELECT cl_ver FROM changelog ORDER BY cl_ver DESC LIMIT 1';
           
    $result mysql_query($query);
           
    $vers_cl mysql_result($result0);
           
    ?>
    The code works fine on other non-blog portions of the site, just not in the blog, here's the error:
    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/public_html/includes/footer.php on line 6

    I tried to add this to the footer without success:
    PHP Code:
    <?php
           mysql_close
    ();
           
    ?>
           <?php
           
    include('/home/public_html/iedb/includes/config.php');
           
    // Request the text of all the info
           
    $query 'SELECT cl_ver FROM changelog ORDER BY cl_ver DESC LIMIT 1';
           
    $result mysql_query($query);
           
    $vers_cl mysql_result($result0);
           
    ?>
  • mlx
    Senior Member
    • Jan 2001
    • 679
    • 3.8.x

    #2
    Without knowing what exactly is in that config.php ... mysql_connect() and mysql_select_db() appears to be missing before you run your mysql_query().
    Planning to continue using VB 3.8 post EOL? Then join the VB 3.8 Forever group and vB3Forever.org!

    Comment

    • Mainer82
      Senior Member
      • Apr 2003
      • 1285
      • 1.1.x

      #3
      Hi, the config file handles the connection and selection.

      Comment

      • Mainer82
        Senior Member
        • Apr 2003
        • 1285
        • 1.1.x

        #4
        Anyone?

        Comment

        • derfy
          Senior Member
          • Jul 2005
          • 244
          • 3.8.x

          #5
          Put in some debug code that outputs $result

          Comment

          • Mainer82
            Senior Member
            • Apr 2003
            • 1285
            • 1.1.x

            #6
            Unfortunately my PHP is a bit limited as I'm still learning, how would I do this?

            Comment

            • Mainer82
              Senior Member
              • Apr 2003
              • 1285
              • 1.1.x

              #7
              Any ideas?

              Comment

              • Mainer82
                Senior Member
                • Apr 2003
                • 1285
                • 1.1.x

                #8
                Anyone?

                Comment

                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                Working...
                😀
                😂
                🥰
                😘
                🤢
                😎
                😞
                😡
                👍
                👎