7 Replies - 7467 Views - Last Post: 18 February 2011 - 03:57 AM Rate Topic: -----

#1 jagadish_c  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 31
  • Joined: 10-January 11

Drupal: How to connect to mysql database and fetch data in drupal

Posted 11 February 2011 - 05:40 AM

Hi all. I have started this week to learn the Drupal 7. It is very interesting. But I am not getting that how to connect to mysql database and to fetch from it. I searched for many tutorials related, but I found none of them useful. Can anybody help me with this?
Is This A Good Question/Topic? 0
  • +

Replies To: Drupal: How to connect to mysql database and fetch data in drupal

#2 Sadin56  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 183
  • Joined: 19-December 10

Re: Drupal: How to connect to mysql database and fetch data in drupal

Posted 11 February 2011 - 08:39 AM

There should be some type of config file that you must edit to enter the connection details for your database such as Wordpress does and phpbb

im not familiar with drupal but im guessing thats how its done?
Was This Post Helpful? 0
  • +
  • -

#3 jagadish_c  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 31
  • Joined: 10-January 11

Re: Drupal: How to connect to mysql database and fetch data in drupal

Posted 11 February 2011 - 09:49 PM

I want to know the exact file where the connection statements and sql query should written.
Was This Post Helpful? 0
  • +
  • -

#4 Sadin56  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 183
  • Joined: 19-December 10

Re: Drupal: How to connect to mysql database and fetch data in drupal

Posted 14 February 2011 - 07:31 PM

let me look into it real quick

This post has been edited by Sadin56: 14 February 2011 - 07:32 PM

Was This Post Helpful? 0
  • +
  • -

#5 Sadin56  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 183
  • Joined: 19-December 10

Re: Drupal: How to connect to mysql database and fetch data in drupal

Posted 14 February 2011 - 08:00 PM

View Postjagadish_c, on 11 February 2011 - 09:49 PM, said:

I want to know the exact file where the connection statements and sql query should written.


The connection and SQL information does not need to be edited manually.

Download your version of Drupal from Drupal.org.

Then extract the downloaded files onto your server or upload them (depending if your hosting locally or online)

And if you goto the directory on your server where drupal was stored for the frist time an installation guide/setup page will appear follow all step in the guide then your site should be up and running

The connection details are entered during the setup via the installer :gunsmilie: hope that helped :)
Was This Post Helpful? 1
  • +
  • -

#6 Valek  Icon User is offline

  • The Real Skynet
  • member icon

Reputation: 514
  • View blog
  • Posts: 1,604
  • Joined: 08-November 08

Re: Drupal: How to connect to mysql database and fetch data in drupal

Posted 14 February 2011 - 08:53 PM

Assuming you're talking about working with SQL within Drupal's framework for a module you're writing yourself, you should give this and this a look to get you started with module development. If you're talking about getting it to connect overall, then Sadin56 is correct. Drupal is designed that to add custom functionality, you would create a module as opposed to altering its base code yourself.
Was This Post Helpful? 1
  • +
  • -

#7 Sadin56  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 183
  • Joined: 19-December 10

Re: Drupal: How to connect to mysql database and fetch data in drupal

Posted 15 February 2011 - 07:01 AM

View PostValek, on 14 February 2011 - 08:53 PM, said:

Assuming you're talking about working with SQL within Drupal's framework for a module you're writing yourself, you should give this and this a look to get you started with module development. If you're talking about getting it to connect overall, then Sadin56 is correct. Drupal is designed that to add custom functionality, you would create a module as opposed to altering its base code yourself.


Thank you for posting this i hadnt even considered that :)

This post has been edited by Sadin56: 15 February 2011 - 07:01 AM

Was This Post Helpful? 0
  • +
  • -

#8 jagadish_c  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 31
  • Joined: 10-January 11

Re: Drupal: How to connect to mysql database and fetch data in drupal

Posted 18 February 2011 - 03:57 AM

View PostValek, on 14 February 2011 - 08:53 PM, said:

Assuming you're talking about working with SQL within Drupal's framework for a module you're writing yourself, you should give this and this a look to get you started with module development.

You have assumed right. :bigsmile: As mentioned earlier that I am a beginner in Drupal and the links you gave are useful and going through it. :scooter: Also learning about modules from the link you gave.

View PostSadin56, on 14 February 2011 - 08:00 PM, said:

View Postjagadish_c, on 11 February 2011 - 09:49 PM, said:

I want to know the exact file where the connection statements and sql query should written.


The connection and SQL information does not need to be edited manually.

Download your version of Drupal from Drupal.org.

Then extract the downloaded files onto your server or upload them (depending if your hosting locally or online)

And if you goto the directory on your server where drupal was stored for the frist time an installation guide/setup page will appear follow all step in the guide then your site should be up and running

The connection details are entered during the setup via the installer :gunsmilie: hope that helped :)

Thanks for your quick reply Sadin. :rolleyes:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1