How to detect a TINYINT/BOOLEAN Column of a query result
How to detect a TINYINT/BOOLEAN Column of a query result
How can I detect TINYINT or BOOLEAN field from a Query Result
- kielsoft
- Posts: 25
- Joined: March 1st, 2012, 3:39 pm
RE: How to detect a TINYINT/BOOLEAN Column of a query result
Hi,
http://php.net/manual/en/function.mysql-fetch-field.php look for the result value, the "type" field?
Regards,
Jakub Misek
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
RE: How to detect a TINYINT/BOOLEAN Column of a query result
@Jakub, thanks so much for your response, but what I mean is that how can I determine if a column is really a TINYINT, MySQL convert Boolean to Tinyint (1) automatically.
In mysql_fetch_field or mysql_fetch_type Tinyint and other numeric type column are returned as "int" type in normal php.
I am write a phalanger application that will create columns in DataDridView automatically according to the structure of result of a query and I want any field of the result with TINYINT in MySQL to form a grid column ofSystem.Boolean as it DataType so as to display CheckBox instead of a System.String column that will dislay ordinary text.
More so, I will like to participate by submitting simple projects as tutorials for new users to go through.
Hope to here from you soon,
Thanks.
- kielsoft
- Posts: 25
- Joined: March 1st, 2012, 3:39 pm
Re: How to detect a TINYINT/BOOLEAN Column of a query result
- Code: Select all
mysql_query("SHOW COLUMNS FROM $table")
btw MySQL does not have Boolean, it only has TinyInt of size 1.
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Return to MySql Extension project
Who is online
Users browsing this forum: No registered users and 0 guests