Query WP data with the WPDB API from outside WordPress

Forgot to mention something:

file1.php (with all the SQL functions) does include wp-config.php
to get the DB info, which could be related to this issue, right?

Dollars to doughnuts, this is your problem. You should never, ever, ever need to load wp-config.php directly.

Are you trying to access WordPress functions from outside WordPress?

Edit

To access WordPress functions from outside the normal WordPress environment, you want to include wp-load.php, not wp-config.php.

Basic example:

<?php
require( 'path/to-wordpress/wp-load.php' );
?>

Edit 2

I don’t [need to access WordPress functions]. Just the DB info (host,user,password). The app I’m working on installs some extra tables in the WP db. The app will not need to touch any of WP’s data. IT just uses the DB info to access its own data, in its own tables just using the same Database as the one WP uses. I would prefer to just make my own DB in the users MySQL but most users wont have permission to do so. So I have to use WP’s database, but my own tables. Although the app requires WP to be installed, I don’t need to access any of WP’s functions ATM.

In this case, you don’t need to load WordPress. You’re simply accessing the database. Just omit the line entirely.