note 70069 added to function.odbc-num-fields
| From: | udin at osu1 dot php dot net | Date: | Mon, 02 Oct 2006 09:31:33 +0000 |
| Subject: | note 70069 added to function.odbc-num-fields | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117931@lists.php.net to get a copy of this message | ||
<?php
$conn = odbc_connect('MySQL','','');
echo "Database = " . "MySQL";
$res = odbc_tables($conn);
------------------------------------
Using odbc_num_fields() for showing description of an object table in one database
------------------------------------
while (odbc_fetch_row($res))
{
$jml = odbc_num_fields($res);
for($i=1;$i<=$jml;$i++)
{
echo odbc_field_name($res,$i) . " = " . odbc_result($res,$i);
}
}
------------------------------------
The 2nd example of using odbc_num_fields(). It retrieves FIELD NAME and FIELD VALUE for each record
in CUSTOMER Table
------------------------------------
$sql = 'SELECT * FROM PEGAWAI';
$rs = odbc_exec($conn,$sql);
while (odbc_fetch_row($rs))
{
for($j=1;$j<=odbc_num_fields($rs);$j++)
echo odbc_field_name($rs,$j) . " = " . odbc_result($rs,$j) ;
}
?>
xdean78@yahoo.com
----
Server IP: 66.163.161.117
Probable Submitter: 222.124.242.116
----
Manual Page -- http://www.php.net/manual/en/function.odbc-num-fields.php
Edit -- https://master.php.net/note/edit/70069
Del: integrated -- https://master.php.net/note/delete/70069/integrated
Del: useless -- https://master.php.net/note/delete/70069/useless
Del: bad code -- https://master.php.net/note/delete/70069/bad+code
Del: spam -- https://master.php.net/note/delete/70069/spam
Del: non-english -- https://master.php.net/note/delete/70069/non-english
Del: in docs -- https://master.php.net/note/delete/70069/in+docs
Del: other reasons-- https://master.php.net/note/delete/70069
Reject -- https://master.php.net/note/reject/70069
Search -- https://master.php.net/manage/user-notes.php