Bug #51189 [Opn]: mysql_field_len reporting value incorrectly

From: Date: Wed, 03 Mar 2010 01:30:04 +0000
Subject: Bug #51189 [Opn]: mysql_field_len reporting value incorrectly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-148191@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51189&edit=1

 ID:               51189
 User updated by:  ste dot sullivan at gmail dot com
 Reported by:      ste dot sullivan at gmail dot com
 Summary:          mysql_field_len reporting value incorrectly
 Status:           Open
 Type:             Bug
 Package:          MySQL related
 Operating System: Gentoo
 PHP Version:      Irrelevant

 New Comment:

Ooops - The second expected result should be: Phone { string ( 16 ) }

The version information also seems to have been wiped from my original
post:

PHP: 5.2.12-pl0-gentoo
MYSQL Client API: 5.0.84


Previous Comments:
------------------------------------------------------------------------
[2010-03-03 02:01:13] ste dot sullivan at gmail dot com

Description:
------------
I am using Gentoo

Test script:
---------------
$db=mysql_connect("localhost","user","pass");
$q=mysql_query("SELECT * FROM mytable");
for($i=0;$i<mysql_num_fields($q);$i++) {
  $fnames[$i]=mysql_field_name($q,$i);
  echo $fnames[$i]." { ".mysql_field_type($q,$i)." (
".mysql_field_len($q,$i)." ) }\n";
}

Expected result:
----------------
Name { string ( 50 ) }
Phone { string ( 48 ) }
Email { string ( 255 ) }

Actual result:
--------------
Name { string ( 150 ) }
Phone { string ( 48 ) }
Email { string ( 765 ) }


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51189&edit=1


Thread (6 messages)

« previous php.bugs (#148191) next »