Hi guys, I'd like to know if there is an easy way to use PHP to return from the database what format each of the columns in a certain table is? For example, I can get it to return all the rows, that's easy ... but is there a way to find out if column 1 is a int(11) or if column 3 is varchar, and how many max characters it can hold? Or even to tell me what the primary key is and any unique columns? Thanks in advance for your help.
Thanks for the pointers so far. I tried DESCRIBE tablename and also SHOW FIELDS FROM tablename but in both these cases I only get 'Resource id #2'. Any ideas why this is? Thanks again.
OK, My bad ... I figured that bit out. Another question ... If a field is a binary this only shows that it is type: string. Is there any way to find out if it is binary? Also, the max_length that it is reporting is obviously the length of the longest object in that filed, not the max characters allowed. Is there any way to find this out? Thanks again.
Have you had a look at the manual? Two minutes of searching around and I found this: http://uk3.php.net/manual/en/function.mysql-field-flags.php Also, you might want to download myphpadmin and pick it apart to help understand how the mysql functions can work together Brew