SQL PHP HTML ASP JavaScript articles and free scripts to download If you are facing any problem in viewing this page, please tell us
 
 

MSSQL Data Display using PHP functions


We can collect records or data from MSSQL database by using PHP. Here we will use some exclusive php function to interact and collect data from MSSQL db. These functions will be available for use if MSSQL support is enabled in php configuration file php.ini.

We will use two php functions to interact with MSSQL. We assume that the connection to MSSQL is already established and we will move from that step onwards.

We will use the function mssql_query() to execute the SQL select query.

$query="select * from emp_m ";
$qt=mssql_query($query);


The pointer of this function we will use as input to mssql_fetch_array() , this mssql_fetch_array() function will return the array of records. We will use while loop to display all the records collected inside the array.

Here is the complete code to display the records from a MSSQL table.

$dbusername='';
$dbpassword='';
$servername='';
$link= mssql_connect ($servername,$dbusername,$dbpassword);
$query="select * from emp_m ";
$qt=mssql_query($query);
while($nt=mssql_fetch_array($qt)){
echo "$nt[emp_no]"." $nt[name]";
echo "<br>";
}


How to display data from mysql table ?



Sections
PHP
JavaScript
ASP
HTML
SQL
Photoshop
Articles SEO
PHP Tutorials
PHP Monthly Planner
PHP Introduction
Loops & structure
Array
Date & Time
Functions
Form Handling
File Handling
Math Functions
String Functions
GD Functions
Comment Posting
Content Management
PHP & Ajax
Popular Tutorials
Drop down list
File Upload
Signup script
Member Login
Line Graph
PHP MySQL Paging
PHP Calendar
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.