View Single Post
Old 06-10-2008, 02:08 PM   #3 (permalink)
pipesportugal
The Contributor
 
pipesportugal's Avatar
 
Join Date: May 2008
Location: Oporto-Portugal
Posts: 32
Thanks: 11
pipesportugal is on a distinguished road
Default

Hi Salathe,

I really was not expecting anyone to reply so soon, as my idea is(was...) that most talkphp members were on the left side of the Atlantic Ocean therefore by time I've sent this thread through, I thought everyone was still spleeping.

As You can (easily) imagine my routine was reading the result of a mySQL query "SHOW COLUMNS FROM table" and then I was using this routine to desintegrate column 2: example: int(7) into: $type=int and $length=7, as I want to develop a simple form generator class(by my own).

In the meanwhile I changed approach and went by this road:
$this->query = "SELECT COLUMN_NAME, DATA_TYPE, NUMERIC_PRECISION, NUMERIC_SCALE, CHARACTER_MAXIMUM_LENGTH, COLUMN_COMMENT from information_schema.columns where table_name = '$table'";

This sql instruction gives me directly the fields that I was looking for.

Regarding Your precious advice, those lines execute its purpose but I must confess that it's difficult for me to "read" Your php lines, as I have never done anything like that before. Looks complicated...from rookie my point of view. Some instructions how to read them in plain English would be nice...

Thanks for caring,
Cheers,
Jose.
pipesportugal is offline  
Reply With Quote