I’m working on an edit view which takes a database table as argument, then loads the fieldnames and display textboxes, textareas etc.
However, I don’t really want textboxes for every field. Some fields in my database are of the TEXT type; for them i want to display a textarea. Other fields are TINYINT, for them I want to display a checkbox.
Is it possible to determine the type of a database field and then work from that in my PHP?
Thanks in advance.
SHOW COLUMNS FROM table;provides the information you’ll need.Have a look here for more information http://dev.mysql.com/doc/refman/5.0/en/show-columns.html