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

LAST READ: APR 17 2024 | Q. BY: JAY BANKAR

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 Us: advertise@gdatamart.com

Donate Us: Support to GDATAMART

LifeStyle & Fun

© 2024 GDATAMART.COM (All Rights Reserved)