e-sites / php-mysql-mysqli-wrapper

MIT License
98 stars 40 forks source link

mysql_fetch_field if $field_offset == 0 #13

Open paolobia opened 3 years ago

paolobia commented 3 years ago

check this changes

if $field_offset== 0 mysqli_field_seek is not call and mysqli_fetch_field fail

function mysql_fetch_field(mysqli_result $result, $field_offset = -1)
{
        if ($field_offset>=0) {
            mysqli_field_seek($result, $field_offset);
        }

        $foo = mysqli_fetch_field($result);

        // increase mysql_fetch_field compatibility ;-)
        if ($foo->flags & 2) $foo->primary_key = 1;
        if ($foo->flags & 4) $foo->unique_key = 1;

    return $foo;
}