Easy Tutorial
❮ Func Ftp Ssl Connect Func Xml Get Current Byte Index ❯

PHP mysqli_field_tell() Function

PHP MySQLi Reference Manual

Retrieve all field information and then use mysqli_field_tell() to get the current field and output the field name, table, and maximum length:

<?php 
// Assume database username: root, password: 123456, database: tutorialpro 
$con = mysqli_connect("localhost", "root", "123456", "tutorialpro"); 
if (mysqli_connect_errno($con)) 
{ 
    echo "Failed to connect to MySQL: " . mysqli_connect_error(); 
} 

$sql = "SELECT name, url FROM websites ORDER BY alexa";

if ($result = mysqli_query($con, $sql))
{
    // Get all field information
    while ($fieldinfo = mysqli_fetch_field($result))
    {
        // Get current field information
        $currentfield = mysqli_field_tell($result);

        printf("Column %d", $currentfield);
        echo "<br>";
        printf("Field name: %s", $fieldinfo->name);
        echo "<br>";
        printf("Table name: %s", $fieldinfo->table);
        echo "<br>";
    }
    // Free result set
    mysqli_free_result($result);
}

mysqli_close($con);
?>

Definition and Usage

The mysqli_field_tell() function returns the position of the field pointer.


Syntax

Parameter Description
result Required. Specifies a result set identifier returned by mysqli_query(), mysqli_store_result(), or mysqli_use_result().

Technical Details

Return Value: Returns the current offset of the field pointer.
PHP Version: 5+
--- ---

❮ Func Ftp Ssl Connect Func Xml Get Current Byte Index ❯