How to get the site name in drupal 6? In some situations, I need the site name of a Drupal 6 site which is given while installation of the site.

How can I achieve it?
In both Drupal 6 and Drupal 7, you can use variable_get.
The CMI initiative will likely deprecate this function in Drupal 8.

$name = variable_get('site_name', '');


Notice the blank '' at the end, which is the "default" value, in case a variable isn't defined.