Collections:
Returning Result from Query with MSSQL Connection
How To Receive Returning Result from a Query?
✍: Guest
When you execute a SQL SELECT statement with the mssql_query() function, you can capture the returning result with a result set object with the following syntax:
$result_set = mssql_query($sql_statement); #- The returning value could be a Boolean value FALSE, #- if the execution failed.
The result set object represents the result in rows and column. The tutorial below shows you how to capture the result set:
<?php
$con = mssql_connect('LOCALHOST','sa','FYIcenter');
mssql_select_db('FyiCenterData', $con);
$sql = 'SELECT GETDATE()';
$res = mssql_query($sql, $con);
$date = mssql_result($res,0,0);
print("Database current time: ". $date ."\n");
mssql_close($con);
?>
If you run this script, you will get something like this:
Database current time: Jun 2 2007 4:37PM
⇒ mssql_fetch_array() - Looping through Result Set Objects
⇐ Turning Off PHP Warning Messages for MSSQL Connection
⇑ SQL Server FAQs - PHP MSSQL Functions - Connections and Query Execution
2024-03-23, 2362🔥, 0💬
Popular Posts:
How To Change the Name of a Database User in SQL Server? If you want to change the name of an existi...
Where Is the Export Dump File Located in Oracle? If you are not specifying the dump directory and fi...
How To Select All Columns of All Rows from a Table with a SELECT statement in SQL Server? The simple...
How To Install Oracle Database 10g XE in Oracle? To install 10g universal edition, double click, Ora...
What is dba.FYIcenter.com Website about? dba.FYIcenter.com is a Website for DBAs (database administr...