Multisite WordPress plugin feed db prefix issues

I am working on a special calendar plugin for our site and I am running into some issues trying to collect database information. The calendar system we are using requires a json feed from the database.

For example we will have a link like the following
http://example.com/wp-content/ThemeName/calendar/calFeed.php

Read More

We have created the database connection using the following:

require_once('../../../../../wp-config.php');
mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);

The Issue is that because the system is using a multisite installation the prefix is appended with a number for each site. I am trying to figure out how to get that number my current code is as follows:

$prefix = $wpdb->prefix;

Any help on this matter is greatly appreciated.

Related posts