Suppose we have a Drupal site and an external application, and we want to use the same login for both. For example, we have an application which does something, but we have our users handled by Drupal, and we need to pass over to the application the information about the current user.
Basically we need to tap into our Drupal's user database table. We also need to use Drupal's $_SESSION, but Drupal stores its sessions in the database by default, and the $_SESSION superglobal...
First remember on which operating system(ubuntu,centos) you are going to install drupal. Here I tested with ubuntu and cent OS.
Add these lines to example.com/sites/sites.php
$sites['dev.site1.com'] = 'site1.com';
$sites['dev.site2.com'] = 'site2.com';
mkdir site1.com/ site2.com/
cp default/default.settings.php site1.com/settings.php...
1. For select Query.
$result = db_select('node', 'n')
Above Example is Equivalent to the Following in D6
$result = db_query("select * from node where nid)=$node->...