Using wpdb to connect to another database
-
Hi there,
I am currently developing a page that pulls data from another MySQL Database on the same server as my WordPress install.
I am trying to use a new instance of wpdb but it doesnt seem to be working.global $wpdb, $crmdb, $current_user; $crmdb = new wpdb("db user","Password","DB name","localhost"); $crmdb->show_errors(); $crmdb->set_prefix(''); //Tried this with and without this line other DB does not have a prefix. $sql= "select * from accounts_cstm where id_c='$crmid'";//SQL to crm db table $insur = $crmdb->get_results($sql); foreach($insur as $row) { echo $row->id_c; //id_c is one of the field names. } //print_r($insur); //tried this to see what all info was being generated...none.It isnt even giving me an error to go with.
Any ideas?
Thanks
Jamie
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Using wpdb to connect to another database’ is closed to new replies.