php - To fetch another database content in my wp site -


I have a php site and a WordPress site. I want to connect php site DB to my WordPress site.

I have tried like this

  define ('dbinn', 'maidibam'); Define ('DB_USER', 'myusername'); Define ('DB_PASSWORD', 'mypassword'); Define ('db_host', 'my-host'); $ Second_db = new wpdb (DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); $ Your_query = "Select Doctors"; $ Result = $ sec_db- & gt; Get_results ($ your_query); Print_r ($ result);  

array () Warning: header information can not be modified - already sent headers

I need to display table data in my subject how is possible? Please help me

Try without defined variables or rename your variable

try it < / P>

  Define ('DB_NAME_1', 'mydbname'); Define ('DB_USER_1', 'myusername'); Define ('DB_PASSWORD_1', 'mypassword'); Define ('DB_HOST_1', 'my-host'); $ Second_db = new wpdb (DB_USER_1, DB_PASSWORD_1, DB_NAME_1, DB_HOST_1); $ Your_query = "Select Doctors"; $ Result = $ sec_db- & gt; Get_results ($ your_query); Print_r ($ result);  

Or try with

  $ second_db = new wpdb ('myusername', 'mypassword', 'mydbname', 'my-host') ; $ Your_query = "Select Doctors"; $ Result = $ sec_db- & gt; Get_results ($ your_query); Print_r ($ result);  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -