WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I Have a Wordpress Site with few users who are my college students

They Registered using their RollNumbers/HallTicket Numbers as their usernames in Wordpress site

Now I Have Another Database with Their Personal Details like Marks, Rank etc

Now I want to Integrate this Database to Wordpress so that when student/user logins , then he/her could see their respective marks and other details

I Just want your suggestions/ideas to implement this, Not asking for a Complete solution


share|improve this question
Please clarify what exactly you are asking. You have WP, custom table, users... Then what? – Rarst Oct 16 '12 at 19:12
@Rarst Question Edited, Could u please suggest me – Aryan Oct 16 '12 at 19:18
use wp_get_current_user()->ID to get the id of the current logged in user & then create an instance of wpdb class & use it to query the data – Mridul Aggarwal Oct 16 '12 at 19:28
up vote 1 down vote accepted

You can use wpdb class to query your custom data from MySQL. Depending on your implementation you would either use:

  • global $wpdb object, if your custom data is in same database as WP itself
  • new custom instance of wpdb class if you need to connect to different database for custom data
share|improve this answer
We can use wpdb custom queries, but where we need to write our custom queries , we need to create a php file for that or we need to write it in an existing file ?? – Aryan Oct 16 '12 at 20:06
@Aryan that can be done in different places, typical are theme's functions.php or creating a plugin. – Rarst Oct 16 '12 at 20:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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