Actually I've alreasdy worked it out- sorry
-----Original Message-----
From: caspar kennerdale [mailto:[EMAIL PROTECTED]]
Sent: 17 March 2002 10:31
To: [EMAIL PROTECTED]
Subject: [PHP] mysql fetch field
I seem to be getting unexpected information from a mysql fetch field query.
My table has three fields- here is the schema-
CREATE TABLE template (
id smallint(6) NOT NULL auto_increment,
name mediumtext NOT NULL,
multiple tinyint(4) DEFAULT '0' NOT NULL,
PRIMARY KEY (id),
UNIQUE id (id)
);
Using the samplecode on php.net to output an object containing the
properties of eacj field I have been able to output the following
Blob - 0
MaxLength - 1
Multiple Key - 0
Name - id
Not Null - 1
Numeric - 1
Primary Key - 1
Table - template
Type - int
Unique Key - 1
Unsigned - 0
ZeroFill - 0
Blob - 1
MaxLength - 7
Multiple Key - 0
Name - name
Not Null - 1
Numeric - 0
Primary Key - 0
Table - template
Type - blob
Unique Key - 0
Unsigned - 0
ZeroFill - 0
Blob - 0
MaxLength - 1
Multiple Key - 0
Name - multiple
Not Null - 1
Numeric - 1
Primary Key - 0
Table - template
Type - unknown
Unique Key - 0
Unsigned - 0
ZeroFill - 0
Which strange as the first field is specified as having a max length of 1
yet it is a small int with a length of 6.
Likewise the second field is specified as a blob with a maximum length of 7-
yet in my schema it is a medium text.
And again my third field is listed as havingan unkniwn typeyet in the schema
it is a tinyint
Here is my code
$TableInfo = new DB;
$TableInfoArray = $TableInfo ->MySqlGetTableInfo('SELECT * FROM
template');
$a =-1;
$b = -1;
while (++$a < count($TableInfoArray)){
$Content[++$b] = "Blob - ".$TableInfoArray[$a][0]."<br>";
$Content[++$b] = "MaxLength - ".$TableInfoArray[$a][1]."<br>";
$Content[++$b] = "Multiple Key - ".$TableInfoArray[$a][2]."<br>";
$Content[++$b] = "Name - ".$TableInfoArray[$a][3]."<br>";
$Content[++$b] = "Not Null - ".$TableInfoArray[$a][4]."<br>";
$Content[++$b] = "Numeric - ".$TableInfoArray[$a][5]."<br>";
$Content[++$b] = "Primary Key - ".$TableInfoArray[$a][6]."<br>";
$Content[++$b] = "Table - ".$TableInfoArray[$a][7]."<br>";
$Content[++$b] = "Type - ".$TableInfoArray[$a][8]."<br>";
$Content[++$b] = "Unique Key - ".$TableInfoArray[$a][9]."<br>";
$Content[++$b] = "Unsigned - ".$TableInfoArray[$a][10]."<br>";
$Content[++$b] = "ZeroFill - ".$TableInfoArray[$a][11]."<br>";
$Content[++$b] = "<br>";
}
$Content = join('', $Content);
return $Content;
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php