| fetch_object() | ใช้คืนค่า ค่าข้อมูล ของ result ในแถวที่ชี้อยู่ และเก็บไว้ที่ object และเลื่อนไปตัวชี้ชี้ไปยังตำแหน่งถ้ดไป |
|---|
method:fetch_object ();
class:result
return type:object
content:ใช้คืนค่า ค่าข้อมูล ของ result ในแถวที่ชี้อยู่ และเก็บไว้ที่ object และเลื่อนไปตัวชี้ชี้ไปยังตำแหน่งถ้ดไป โดย attribute ที่ได้คือชื่อฟิลด์
example:$conn = new mysqli ( "localhost", "root", "1234" ); $conn->select_db ( "dblabcode" ); $result = $conn->query ( "SELECT * FROM employee" ); while ( $record = $result->fetch_object() ) { echo $record->name; echo $record->sex; }