web 2.0

How to use PHP & SQL Server (mssql) Get Field Name

How to use PHP & SQL Server (mssql) Get Field Name Learn / tutorial php programming how to usingĀ  PHP get table field name from SQL Server database

ShotDev Focus:
- PHP & SQL Server get field name from table.

Example

php_sqlserver_list_table.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
$objConnect = mssql_connect("localhost","sa","");
$objDB = mssql_select_db("mydatabase");
$strSQL = "SELECT * FROM customer";
$objQuery = mssql_query($strSQL) or die ("Error Query [".$strSQL."]");
$intNumField = mssql_num_fields($objQuery);
$i = 0;
echo "<b>Table customer have $intNumField Fields.</b><br>";
for($i=1;$i<$intNumField;$i++)
{
echo $i."=".mssql_field_name($objQuery,$i)." (".mssql_field_type($objQuery,$i).")<br>";
}
mssql_close($objConnect);
?>
</body>
</html>

Create a php file and save to path root-path/myphp/

Run
http://localhost/myphp/php_sqlserver_list_table.php

Screenshot

PHP & SQL Server (mssql) Get Table Properties
.
.
.

Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.