#28912 [Opn->Fbk]: MYSQLI_TYPE_STRING != mysqli_fetch_field() type for VARCHAR column

From: Date: Mon, 28 Jun 2004 16:51:15 +0000
Subject: #28912 [Opn->Fbk]: MYSQLI_TYPE_STRING != mysqli_fetch_field() type for VARCHAR column
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-61442@lists.php.net to get a copy of this message
ID: 28912 Updated by: georg@php.net Reported By: danielc at analysisandsolutions dot com -Status: Open +Status: Feedback Bug Type: MySQL related Operating System: Windows 2000 PHP Version: 5CVS-2004-06-24 (dev) New Comment: Looks like a documentation problem. However I couldn't find this in documentation. Also the example output in mysqli_fetch_field returns 254. Could you please give me a link to the wrong documentation? Previous Comments: ------------------------------------------------------------------------ [2004-06-24 18:50:07] danielc at analysisandsolutions dot com Description: ------------ The "type" value returned from mysqli_fetch_field() for a VARCHAR field is 253. The manual says the constant for VARCHAR fields is MYSQLI_TYPE_STRING which has a value of 254. So, there's no way to determine column types via constants for VARCHAR's. Reproduce code: --------------- mysqli_query($db->connection, 'CREATE TABLE bar (Cf VARCHAR(5))'); $r = mysqli_query($db->connection, 'SELECT Cf FROM bar'); $tmp = mysqli_fetch_field($r); echo "type found = $tmp->type\n"; echo 'MYSQLI_TYPE_STRING = ' . MYSQLI_TYPE_STRING . "\n"; mysqli_query($db->connection, 'DROP TABLE bar'); Expected result: ---------------- type found = 254 MYSQLI_TYPE_STRING = 254 Actual result: -------------- type found = 253 MYSQLI_TYPE_STRING = 254 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28912&edit=1

« previous php.bugs (#61442) next »