note 34181 deleted from function.mysql-fetch-field by didou

From: Date: Wed, 14 Jan 2004 12:24:56 +0000
Subject: note 34181 deleted from function.mysql-fetch-field by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-63523@lists.php.net to get a copy of this message
Note Submitter: creak@foolstep.com ---- I think i've found a good way to separate the type and its length, for examples : - "int(11)" has type "int" and length "11" - "enum('N','Y')" has type "enum" and length "'N', 'Y'" [CODE] $result = mysql_query("DESC users", $link_id); while ($data = mysql_fetch_array($result)) { ereg("([a-zA-Z]+)\((.+)\)", $data['Type'], $type); // $type[1] <=> type // $type[2] <=> length } mysql_free_result($result); [/CODE] The ereg() function is shorter but i think it can handle quite all types :) By the way, why is there so few tuts about the pattern possibility for the ereg() function ? Creak

« previous php.notes (#63523) next »