ความหมายและการใช้งานฟังก์ชัน odbc_error()

 

    ฟังก์ชั่น odbc_error() คือ ฟังก์ชันที่แจ้งเตือนข้อความ  Error ของ Code ล่าสุด ใช้ในการเชื่อมต่อ PHP กับ SQL Server ได้หลาย ๆ Database ผ่าน ODBC ใน PHP มี Function php_odbc สำหรับการติดต่อผ่าน Driver อยู่แล้ว และไม่จำเป็นว่าจะต้องเป็น Microsoft Access (ไมโครซอฟท์ แอคเซส) เท่านั้น


รูปแบบ (Syntax)

 

odbc_error ([ $connection_id ] )

     อธิบาย

          $connection_id  คือ ตัวบ่งชี้การเชื่อมต่อ ODBC (สามารถดูรายละเอียดได้ที่ การใช้งานฟังก์ชั่น odbc_connect() ในการเชื่อมต่อฐานข้อมูล)

 

ตัวอย่าง 

 

<html>
<head>
     <title>Mindphp (Odbc)</title>
</head>
<body>
    // เชื่อมต่อฐานข้อมูล 
<?php
     $db = odbc_exec($dbc, $sql);
     if(odbc_error($dbc)) die("Error");
?>
</body>
</html>

 

ผลลัพธ์

 

ผลลัพธ์ odbc_error
ผลลัพธ์ odbc_error

     จากตัวอย่างจะเห็นได้ว่า ไม่สามารถเชื่อมต่อฐานข้อมูลได้ เลยแสดงข้อความที่กำหนดไว้ 

 

ข้อมูลอ้างอิง : www.w3schools.com

 

ช่องทางการศึกษาเพิ่มเติมข่าวที่น่าสนใจเกี่ยวกับ : ฟังก์ชัน PHP

กระทู้ล่าสุดจากเว็บบอร์ด
หัวข้อกระทู้
ตอบ
เปิดดู
ล่าสุด
เทคนิคการเขียน Test Case ให้ครอบคลุม
โดย athirach.offcial ส 30 มี.ค. 2024 12:50 pm บอร์ด Software testing
0
136
ส 30 มี.ค. 2024 12:50 pm โดย athirach.offcial View Topic เทคนิคการเขียน Test Case ให้ครอบคลุม
Automated test เหมาะสำหรับงานเทสแบบไหน
โดย athirach.offcial ส 30 มี.ค. 2024 12:46 pm บอร์ด Software testing
0
142
ส 30 มี.ค. 2024 12:46 pm โดย athirach.offcial View Topic Automated test เหมาะสำหรับงานเทสแบบไหน
การตรวจสอบภาคจ่ายไฟให้กับ HDD และการระบุปัญหา คอมใช้สัดพักแล้วดับ เครื่อง รีสตาร์ทเอง
โดย mindphp ส 30 มี.ค. 2024 12:43 pm บอร์ด Microsoft Office Knowledge & line & Etc
1
158
ส 30 มี.ค. 2024 12:51 pm โดย mindphp View Topic การตรวจสอบภาคจ่ายไฟให้กับ HDD และการระบุปัญหา คอมใช้สัดพักแล้วดับ เครื่อง รีสตาร์ทเอง
การใช้ Selenium เพื่อเช็คความเร็วของหน้าเว็บ
โดย athirach.offcial ส 30 มี.ค. 2024 12:39 pm บอร์ด Software testing
0
158
ส 30 มี.ค. 2024 12:39 pm โดย athirach.offcial View Topic การใช้ Selenium เพื่อเช็คความเร็วของหน้าเว็บ
การใช้ Python เขียนโปรแกรม GUI เพื่อใช้รัน Selenium
โดย athirach.offcial ส 30 มี.ค. 2024 12:35 pm บอร์ด Software testing
0
158
ส 30 มี.ค. 2024 12:35 pm โดย athirach.offcial View Topic การใช้ Python เขียนโปรแกรม GUI เพื่อใช้รัน Selenium
การใช้งาน Selenium ข้อดีและข้อเสีย
โดย athirach.offcial ส 30 มี.ค. 2024 12:32 pm บอร์ด Software testing
0
125
ส 30 มี.ค. 2024 12:32 pm โดย athirach.offcial View Topic การใช้งาน Selenium ข้อดีและข้อเสีย
แนะนำเวอร์ชัน Python ในปัจจุบัน Python 3.10 หรือ Python 3.11
โดย athirach.offcial ศ 29 มี.ค. 2024 3:20 pm บอร์ด Python Knowledge
0
676
ศ 29 มี.ค. 2024 3:20 pm โดย athirach.offcial View Topic แนะนำเวอร์ชัน Python ในปัจจุบัน Python 3.10 หรือ Python 3.11
การทำงานกับ Selenium ร่วมกับคำสั่ง if-else
โดย athirach.offcial ศ 29 มี.ค. 2024 3:12 pm บอร์ด Software testing
0
164
ศ 29 มี.ค. 2024 3:12 pm โดย athirach.offcial View Topic การทำงานกับ Selenium ร่วมกับคำสั่ง if-else