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


  • 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

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
  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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