note 69718 added to function.mysql-field-type
| From: | fusionstream at gmail dot com | Date: | Sun, 17 Sep 2006 16:19:22 +0000 |
| Subject: | note 69718 added to function.mysql-field-type | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117265@lists.php.net to get a copy of this message | ||
krang at krang dot org dot uk
Condensed version of what KRANG said.
To get info on the MYSQL field type, use this code
<?
$result = mysql_query("SHOW FIELDS FROM db_name");
$i = 1;
while ($row = mysql_fetch_array($result)) { //go through one field at a time
echo "Field $i: ";
print_r($row) //display all information about A field which can be accessed thru the
"$row" array.
$i++;
}
?>
Will display something like:
Field 1: Array ( [Field] => SN [Type] => mediumint(8) unsigned [Null] => [Key] => PRI
[Default] => [Extra] => auto_increment ) , SN, mediumint(8) unsigned
Field 2: Array ( [Field] => ENTITY_ID [Type] => varchar(20) [Null] => [Key] => [Default]
=> [Extra] => ) , ENTITY_ID, varchar(20)
----
Server IP: 66.163.161.117
Probable Submitter: 218.186.10.10 (proxied: 222.164.112.166)
----
Manual Page -- http://www.php.net/manual/en/function.mysql-field-type.php
Edit -- https://master.php.net/note/edit/69718
Del: integrated -- https://master.php.net/note/delete/69718/integrated
Del: useless -- https://master.php.net/note/delete/69718/useless
Del: bad code -- https://master.php.net/note/delete/69718/bad+code
Del: spam -- https://master.php.net/note/delete/69718/spam
Del: non-english -- https://master.php.net/note/delete/69718/non-english
Del: in docs -- https://master.php.net/note/delete/69718/in+docs
Del: other reasons-- https://master.php.net/note/delete/69718
Reject -- https://master.php.net/note/reject/69718
Search -- https://master.php.net/manage/user-notes.php