Quantcast
Channel: Topic Tag: database | WordPress.org
Viewing all articles
Browse latest Browse all 11065

heyihsan on "Include a php file that connects to another database to a page"

$
0
0

Hey guys, pretty new to Wordpress and PHP development and I'm having some difficulty with this task.

Basically my client has a mysql database(it's on the same server as wordpress db) and a php file that works with a few other files (one that actually connects to the database) and outputs some data and html formatting. I've been trying to integrate this into a wordpress page but the include command doesn't seem to work. This is probably because it's trying to connect to a second database, because when I include a php file with just an echo, it displays fine.

I've read that you can use something called a wpdb class but I don't know where it should go or how it's used it in this situation. If anyone could maybe direct me into the right direction, I would really appreciate it.

The way the php file works is that it includes these two other files, a func.php and a config.php file, config has the mysql credentials and func file makes the actual connection. It works just fine when I open it by itself, but when I include it on a wordpress page using <?php include("file.php") ;?>, nothing comes up. Thank you for all the help!


Viewing all articles
Browse latest Browse all 11065

Trending Articles