how can connect database to SQL?

// Create connection

// Check connection
if (mysql_connect_errno())
  echo "Failed to connect to MySQL: " . mysql_connect_error();

Before we can really answer that you are going to have to tell us which database you are trying to connect to (MySQL, MS SQL Server, Access, Oracle, etc.) and what you are trying to connect from (VB script, web page, php, c, etc.)

#Database properties
// instantiate db connection
$dbconn = mysql_connect($DB_HOST,$DB_USER,$DB_PASSWORD) or die ("Could not connect to database");
mysql_select_db($DB_NAME) or die ("could not open database");

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.