How to check the field name and data type information using SQL in mySQL

Sometimes while working freelance I came across situations where the client only provided FTP access to his website and did not provide cPanel access due to security reasons. The job was usually small and I needed to complete it in quick time so that I could move on to the next project.

I could have uploaded PHPMyAdmin but then I would need to spend time uploading it and then configuring it. So I used mySQL to retrieve field names and data type information from the table.

The SQL is very simple. Suppose there is a table by the name of “logger”

show fields from logger;

I would get the following output


The above is a snap shot of the output as displayed in PHPmyAdmin. I can just as well use the same query in a PHP script and upon executing it I would get the same table related information.

Hope the above helped.

Be the first to comment

Leave a Reply