web 2.0

How to use PHP & Access (odbc) Get Field Name

How to use PHP & Access (odbc) Get Field Name This is tutorial  php developers how to using PHP get field name from a microsoft access database.

ShotDev Focus:
- PHP & Get field name from table.

Example

php_list_table.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
$objConnect = odbc_connect("mydatabase","","");
$strSQL = "SELECT * FROM customer";
$objExec = odbc_exec($objConnect, $strSQL) or die ("Error Execute [".$strSQL."]");
$intNumField = odbc_num_fields($objExec);
$i = 0;
echo "<b>Table customer have $intNumField Fields.</b><br>";
for($i=1;$i<=$intNumField;$i++)
{
echo $i."=".odbc_field_name($objExec,$i)." (".odbc_field_type($objExec,$i).")<br>";
}
odbc_close($objConnect);
?>
</body>
</html>

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

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

Screenshot

PHP Microsoft Access (Get Field Name)
.
.
.

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.