TOP CATEGORIES

×

How to connect to a SQL Server database to the webpage?

S

Sonu Rana

A structured query language (SQL) is a powerful tool for connecting to many database systems that store data in tables organized into rows and columns.


HOW TO SQL WORK

SQL the most popular database tool in the world, including some of Oracle's database systems, MySQL, PostgreSQL, and Microsoft's SQL Server. The common commands in the SQL language like 

  • "SELECT" (The SELECT statement is used to extract data matching some criteria from the database), 
  • "INSERT" (The INSERT statement is used to add new rows to the database),
  • "UPDATE" (The UPDATE statement is used to update existing records in place).

Connection Command in PHP Script

<?php

$host="myname.database.windows.net";

$username="theUser";

$password="password";

$database="databaseName";

$tbl_name="tableName";

// Create connection

$mysql = mysql_connect($host, $username, $password) or die("cannot connect");

mysql_select_db($database);

$sql='SELECT * FROM $tbl_name';

$result=mysql_query($sql);

?>

0 votes

Your Answer

Email: advertise@gdatamart.com

Donate: To Support US

© 2025 GDATAMART.COM (All Rights Reserved)