hello I have an old website https://www.manthanpublication.com/manthantest hosted using Codeigniter as it is hard to customize I decide to change to Wordpress now the problem is I have student result on old website server. I want to access them on Wordpress website, I have PHP scripts from old website to run them on Wordpress but I don't know how to get or access 2nd MySQL database on Wordpress so I can show the student result on Wordpress website new website https://manthanwelfarefoundation.org/

I hope you understand the question/problem if you need an explanation, please ask. Thank You

1 Answer 1


You can create a new instance of the wpdb object. It is explained in many posts like this one: Using wpdb to connect to a separate database

  • $mydb = new wpdb('username','password','database','localhost'); $rows = $mydb->get_results("select Name from my_table"); echo "<ul>"; foreach ($rows as $obj) : echo "<li>".$obj->Name."</li>"; endforeach; echo "</ul>"; i tried that but want to access different server not localhost May 20, 2020 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.