note 114876 added to mysqli-result.fetch-field
| From: | andre at koethur dot de | Date: | Sat, 19 Apr 2014 08:13:11 +0000 |
| Subject: | note 114876 added to mysqli-result.fetch-field | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199294@lists.php.net to get a copy of this message | ||
Here are two methods for converting the 'type' and 'flags' attributes to text
for debugging purposes. They both use the predefined MYSQLI_ constants to generate the text.
<?php
public static function h_type2txt($type_id)
{
static $types;
if (!isset($types))
{
$types = array();
$constants = get_defined_constants(true);
foreach ($constants['mysqli'] as $c => $n) if
(preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) $types[$n] = $m[1];
}
return array_key_exists($type_id, $types)? $types[$type_id] : NULL;
}
public static function h_flags2txt($flags_num)
{
static $flags;
if (!isset($flags))
{
$flags = array();
$constants = get_defined_constants(true);
foreach ($constants['mysqli'] as $c => $n) if
(preg_match('/MYSQLI_(.*)_FLAG$/', $c, $m)) if (!array_key_exists($n, $flags)) $flags[$n]
= $m[1];
}
$result = array();
foreach ($flags as $n => $t) if ($flags_num & $n) $result[] = $t;
return implode(' ', $result);
}
?>
----
Server IP: 213.172.110.14
Probable Submitter: 92.72.72.110
----
Manual Page -- http://php.net/manual/en/mysqli-result.fetch-field.php
Edit -- https://master.php.net/note/edit/114876
Del: integrated -- https://master.php.net/note/delete/114876/integrated
Del: useless -- https://master.php.net/note/delete/114876/useless
Del: bad code -- https://master.php.net/note/delete/114876/bad+code
Del: spam -- https://master.php.net/note/delete/114876/spam
Del: non-english -- https://master.php.net/note/delete/114876/non-english
Del: in docs -- https://master.php.net/note/delete/114876/in+docs
Del: other reasons-- https://master.php.net/note/delete/114876
Reject -- https://master.php.net/note/reject/114876
Search -- https://master.php.net/manage/user-notes.php