Quering MySQL DB from dev portal

Hi @Anil Sagar,

After successful user registration(Page contains field address and contact) in DevPortal, When user is logging in, I need to fetch certain field details like address and contact number from DB and populate it on screen . How exactly I can achieve that? Is there any Management API that is being called to fetch the details?

Regards,

Pratyush

0 4 262
4 REPLIES 4

@Pratyush Mohapatra ,

Apigee Developer Portal is built on top of famous open source CMS Drupal. When it comes to Drupal databases, Fundamental Rule is never directly deal with MySQL queries. Use Drupal APIs / Out of the box modules to connect to DB.

Coming to your questions, It's easy. You can use Drupal Views module to build the screens & display the information you want. You need little bit of Drupal expertise though. You can search in Google, I am sure you will find ton of articles that explains same.

Hi @Anil Sagar,

Any link you can refer to me on Drupal APIs fetching data from the database.

Thanks

I would suggest to use out of the box views module to build various views. Have you explored Drupal Views ?

You can create a custom module with database access to show a report of users to admins, but like @Anil Sagar pointed out, you can use Views to do this much faster:

  1. Go to Structure » Views » Add new view in admin bar
  2. Enter a View Name
  3. Change "Show" to "Users"
  4. Change "Path" if you want
  5. Click "Continue & Edit"
  6. Under "Fields" add as many fields as you want.
  7. You may also want to change "Format" to table
  8. Note that the preview below will change as you make modifications.

You can also modify the View that displays the users under "People" in the admin bar instead to add more fields. It is named "Administration: Users (User)". If you make changes to this view, you can always reset it to defaults by going to the Views list and clicking "Revert" under "Operations"