$result = mysqli_query($conn, $query) $result = the result set returned by the execution of the query |
|
$metaDataObj = mysqli_fetch_field($result) ; // Get meta data of the next column/field
mysqli_fetch_field($result) returns:
a meta data object "stdClass" object that
contains the meta data of the next column (attribute)
in the result set $result
|
$result = mysqli_query($conn, $query); // Execute a query /* ============================================================== Print (ALL) the meta data of each attribute in the result set NOTE: mysqli_fetch_field($result) returns an OBJECT =============================================================== */ while ( ($x = mysqli_fetch_field($result)) != NULL ) { /* ------------------------------------------------ $x contains the meta data of the next attribute ------------------------------------------------ */ print_r($x); // Print the meta data of one attr } |
|
Example 1:
|
Example 2:
|
$result = mysqli_query($conn, $query); // Execute a query
/* ==============================================================
Print ALL the meta data of each attribute in the result set
NOTE: mysqli_fetch_field($result) returns an OBJECT
=============================================================== */
while ( ($x = mysqli_fetch_field($result)) != NULL )
{
print($x->name);
}
|
ssh -X holland Run: /home/cs377001/PHP/intro-PHP/employee-metadata.php |