krx
krx

Reputation: 2683

mysql_field_type differentiate between varchar and text

I need to get the datatype of a column, but both varchar and text datatypes both return the value 'string' under the mysql_field_type function in php.

Is there a better, more specific method of checking a columns datatype?

Upvotes: 1

Views: 281

Answers (2)

Oleksiy Muzalyev
Oleksiy Muzalyev

Reputation: 1038

You are in wrong, mysql_field_type function in php does not return 'string' for the 'text' datatype, but 'blob'.

Upvotes: 0

VoteyDisciple
VoteyDisciple

Reputation: 37803

You can always run a SHOW COLUMNS IN your_table query (via the regular mysql_query() function), which gives you details on the table's columns.

Upvotes: 1

Related Questions