|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-01-07 20:32 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 19 03:00:02 2025 UTC |
Description: ------------ I am trying to fetch a complete mySQL table schema and I found a great function in between the comments for the mysql_fetch_field function. On the documentation page for mysql_fetch_field function you are using $result handle like this $result = mysql_query('select * from table'); .... $meta = mysql_fetch_field($result, $i); The problem is, that the $meta->def value is ALWAYS empty. The problem is also noted here: http://www.phpdig.net/ref/rn41re784.html Te only way it works is if I use a deprecated function (mysql_list_fields()) like this: $result = mysql_list_fields ($dbname, $tablename); .... $meta = mysql_fetch_field($result, $i); in this case the $meta->def is populated correctly! Please make it clear in the documentations OR make it work correctly with you preffered method: $result = mysql_query('select * from table'); best regards Reproduce code: --------------- --- From manual page: function.mysql_fetch_field#Examples --- <?php mysql_connect("127.0.0.1","nobody",""); $result = mysql_query('select * from table'); //... $meta = mysql_fetch_field($result, 0); echo $meta->def; ?> Expected result: ---------------- 0 Actual result: -------------- null