RE: If Column Exists

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jay Blanchard wrote:

> [snip]
> I am working on data migration for one mysql db to another using PHP.
> How do
> I check if a particular table has a particular column. If not alter...
> [/snip]
> 
> Use DESCRIBE TABLE;
> 

Then you'd have to parse the output - how about

SELECT <column> FROM <table> LIMIT 1  ?

The query will fail if the column doesn't exist.


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux