From:             alcofora at netmake dot com dot br
Operating system: Any
PHP version:      4.4.2
PHP Bug Type:     MySQL related
Bug description:  AGAIN - mysql_field_type returns 'unknown' for DECIMAL 
columns in MySQL 5.0+

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 bug report at http://bugs.php.net/?id=36069&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=36069&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=36069&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=36069&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36069&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=36069&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36069&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36069&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36069&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36069&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36069&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=36069&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=36069&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36069&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36069&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36069&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36069&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36069&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36069&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36069&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36069&r=mysqlcfg

Reply via email to