Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

odbc_num_fields

(PHP 3 >= 3.0.6, PHP 4, PHP 5)

odbc_num_fields -- Number of columns in a result

Description

int odbc_num_fields ( resource result_id )

odbc_num_fields() will return the number of fields (columns) in an ODBC result. This function will return -1 on error. The argument is a valid result identifier returned by odbc_exec().



add a note add a note User Contributed Notes
odbc_num_fields
udin
02-Oct-2006 02:31
<?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

odbc_num_rows> <odbc_next_result
Last updated: Fri, 26 Jan 2007
 
 
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571