note 120068 added to mysqli-result.fetch-field
| From: | rvila at revolutionvisualarts dot com | Date: | Thu, 20 Oct 2016 14:59:52 +0000 |
| Subject: | note 120068 added to mysqli-result.fetch-field | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-206931@lists.php.net to get a copy of this message | ||
The predefined constant values returned by the function get_predefined_constants() for:
MYSQLI_TYPE_CHAR = 1
MYSQLI _TYPE_TINYINT = 1
If the code is used to categorized the type of field use this values will of course create
confusion. For example:
if($fieldtype === "CHAR"){
$field_html_attribute = "text";
$field_html_length = 1;
} elseif($fieldtype === "TINYINT") {
$field_html_attribute = "number";
$field_html_length = 1;
}
If an array is created to set the key as the numeric value and the value of that key as the the text
title, TINYINT will be replaced by CHAR value. But is this process is reversed, then the code will
select TINYINT if the foreach statement set to break when the numeric value of the flag equals the
value of the current key as the first intance.
Base in the note added by Johnathan at http://php.net/manual/en/mysqli.field-count.php
the values should be:
CHAR = 254
TINYINT = 1
But predefined function attributes the value 254 to MYSQLI_TYPE_STRING.
Just for FYI
----
Server IP: 72.52.91.14
Probable Submitter: 67.78.118.210
----
Manual Page -- http://php.net/manual/en/mysqli-result.fetch-field.php
Edit -- https://master.php.net/note/edit/120068
Del: integrated -- https://master.php.net/note/delete/120068/integrated
Del: useless -- https://master.php.net/note/delete/120068/useless
Del: bad code -- https://master.php.net/note/delete/120068/bad+code
Del: spam -- https://master.php.net/note/delete/120068/spam
Del: non-english -- https://master.php.net/note/delete/120068/non-english
Del: in docs -- https://master.php.net/note/delete/120068/in+docs
Del: other reasons-- https://master.php.net/note/delete/120068
Reject -- https://master.php.net/note/reject/120068
Search -- https://master.php.net/manage/user-notes.php