karimali831 Posted June 9, 2010 Share Posted June 9, 2010 Hello, With this query, I assume it checks if there are no cup table? if(!mysql_num_rows(mysql_query("SHOW TABLES LIKE '".PREFIX."cups'"))) How can I check if a column existings within a table? So lets say I altered a table and added column "name" and I use a query to check if this column exists? Is there a query I can use for this? Thanks for help. Link to comment https://forums.phpfreaks.com/topic/204304-show-tables-like/ Share on other sites More sharing options...
Mchl Posted June 9, 2010 Share Posted June 9, 2010 Run this query: SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'yourDataBase' AND TABLE_NAME = 'yourTableName' AND COLUMN_NAME = 'columnYouCheckFor' and check if it returns 0 or 1 rows. Link to comment https://forums.phpfreaks.com/topic/204304-show-tables-like/#findComment-1070022 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.