Posted By

fillyouin on 08/17/10


Tagged

database wordpress alternative external


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

fillyouin


Get data from another database into Wordpress


 / Published in: PHP
 

  1. <?php
  2. $wpdbtest_otherdb = new wpdb('db_user', 'db_password', 'db_name', 'localhost');
  3. $wpdbtest_otherdb->show_errors();
  4. $datarows = $wpdbtest_otherdb->get_results("SELECT field,field2,field3 FROM table");
  5.  
  6. foreach ($datarows as $datarow) {
  7. echo $datarow->field;
  8. }
  9. ?>

Report this snippet  

You need to login to post a comment.