ID: 36069
Updated by: [EMAIL PROTECTED]
Reported By: alcofora at netmake dot com dot br
-Status: Open
+Status: Feedback
Bug Type: MySQL related
Operating System: Any
PHP Version: 4.4.2
New Comment:
1) There is no such OS - "Any".
2) With which version of libmysqlclient did you build PHP?
Previous Comments:
------------------------------------------------------------------------
[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