ความหมายและการใช้งานฟังก์ชั่น odbc_fields_name()
ฟังก์ชั่น odbc_num_fields() คือ ฟังก์ชั่นที่ใช้แสดงชื่อฟิลด์ จากการประมวลผลด้วย odbc_exec() การเชื่อมต่อ PHP กับ SQL Server ได้หลาย ๆ Database ผ่าน ODBCใน PHP
รูปแบบ (Syntex)
odbc_field_name($variable)
อธิบาย
$variable คือ ตัวแปร
ตัวอย่าง
<?php
$con = mysqli_connect("localhost", "root","", "dbtest") or die("ไม่สามารถเชื่อต่อฐานข้อมูลได้") ;
$sql="select*from constact";
$result = odbc_exec($con, $sql);
odbc_fetch_row($result);
for ($col=1; $col<=odbc_num_fields($result); $col++)
{
printf("Column Name: %s\n", odbc_field_name($result, $col));
}
?>
ผลลัพธ์
ข้อมูลอ้างอิง : www.w3schools.com