web 2.0

How to use PHP & AdoDB Get Table Properties

How to use PHP & AdoDB Get Table Properties This tutorials/scripts developing with the PHP Scrips Using ADO get table field name from database

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

Example

php_ado_list_table.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?php
$strConn = new COM("ADODB.Connection") or die("Cannot start ADO");
$strConn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("db/mydatabase.mdb"));
$strSQL = "SELECT * FROM customer";
$objRec = $strConn->Execute($strSQL);

$intNumFields = $objRec->Fields->Count();
echo ("<b>Table customer have ".$intNumFields." Fields.</b><br>");

for ($i=0; $i < $intNumFields; $i++) {
echo $objRec->Fields($i)->Name."<br>";
}

$objRec->Close();
$strConn->Close();
$objRec = null;
$strConn = null;
?>
</body>
</html>

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

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

Screenshot

PHP & AdoDB 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 ...

One Response to “How to use PHP & AdoDB Get Table Properties”

  1. 3alertness…

Leave a Reply

You must be logged in to post a comment.