#36069 [Opn->Bgs]: AGAIN - mysql_field_type returns 'unknown' for DECIMAL columns in MySQL 5.0+
| From: | tony2001@php.net | Date: | Wed, 18 Jan 2006 16:35:54 +0000 |
| Subject: | #36069 [Opn->Bgs]: AGAIN - mysql_field_type returns 'unknown' for DECIMAL columns in MySQL 5.0+ | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-92139@lists.php.net to get a copy of this message | ||
ID: 36069
Updated by: tony2001@php.net
Reported By: alcofora at netmake dot com dot br
-Status: Open
+Status: Bogus
Bug Type: MySQL related
Operating System: Windows
PHP Version: 4.4.2
New Comment:
PHP must be compiled with MySQL 5 to support field types that appeared
first in MySQL 5.
Previous Comments:
------------------------------------------------------------------------
[2006-01-18 17:26:29] alcofora at netmake dot com dot br
I'm testing on WINDOWS. I did'n tested on linux yet.
I'm using official php.net package.
PHP 4.4.2
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 3.23.49
I've tested now with PHP 5.1.2 too and also happend the same thing.
Using official package and no changes.
PHP 5.1.2
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 4.1.7
------------------------------------------------------------------------
[2006-01-18 16:55:29] tony2001@php.net
1) There is no such OS - "Any".
2) With which version of libmysqlclient did you build PHP?
------------------------------------------------------------------------
[2006-01-18 16:48:29] alcofora at netmake dot com dot br
Description:
------------
The same problem that happend with PHP 4.4.1 and was reported on ticket
ID# 35536.
Its was solved for php 4.4.1 but is back again on php 4.4.2 the has
been launched last day 13.
When we call 'mysql_field_type' for a decimal field it return as
'unknown'.
Please look this.
Reproduce code:
---------------
<?php
/*
CREATE TABLE
test (
fielda int(11) NOT NULL,
fieldb decimal(10,3) default NULL,
PRIMARY KEY (fielda)
);
*/
mysql_connect("localhost:3306", "root", "123");
mysql_select_db("test");
$result = mysql_query("SELECT * FROM test");
$fields = mysql_num_fields($result);
$rows = mysql_num_rows($result);
$table = mysql_field_table($result, 0);
echo "Your '" . $table . "' table has " . $fields . " fields and
" .
$rows . " record(s)\n";
echo "The table has the following fields:\n";
for ($i=0; $i < $fields; $i++) {
$type = mysql_field_type($result, $i);
$name = mysql_field_name($result, $i);
$len = mysql_field_len($result, $i);
$flags = mysql_field_flags($result, $i);
echo $type . " " . $name . " " . $len . " " . $flags . "\n";
}
mysql_free_result($result);
mysql_close();
?>
Expected result:
----------------
Your 'test' table has 2 fields and 0 record(s) The table has the
following fields: int fielda 11 not_null primary_key real fieldb 12
Actual result:
--------------
Your 'test' table has 2 fields and 0 record(s) The table has the
following fields: int fielda 11 not_null primary_key unknown fieldb 12
not_null
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36069&edit=1