karimali831 Posted June 13, 2010 Share Posted June 13, 2010 Hi, When I use the below query: mysql_query("ALTER TABLE `".PREFIX."settings` ADD `col2` INT(11) NOT NULL default '1' AFTER `col1`, ADD `col3` varchar(255) NOT NULL default 'irc.evolu.net' AFTER `col2`;") OR die(PREFIX.'settings failed'); It will die even though I have col2 but not col3 (column) So lets say I have column col2 and not column col3, how can I change the query to that it will add column 3 only? So basically add what I don't have and never mind the columns that are already there. Thanks for help Quote Link to comment Share on other sites More sharing options...
karimali831 Posted June 13, 2010 Author Share Posted June 13, 2010 no? you can not do this? Quote Link to comment Share on other sites More sharing options...
karimali831 Posted June 14, 2010 Author Share Posted June 14, 2010 Quote Link to comment Share on other sites More sharing options...
karimali831 Posted June 14, 2010 Author Share Posted June 14, 2010 :-\ Quote Link to comment Share on other sites More sharing options...
Soldier Jane Posted June 15, 2010 Share Posted June 15, 2010 I've yet to learn properly how to do this, but I'm guessing it's something like: mysql_query("ALTER tablename ADD col3 varchar (255) NOT NULL default 'irc.evolu.net' AFTER col2"); Might be a couple of mistakes in there but it's along the right lines at least. Quote Link to comment Share on other sites More sharing options...
Illusion Posted June 15, 2010 Share Posted June 15, 2010 You want to have all that intelligence in single query, I think that's not possible. Quote Link to comment Share on other sites More sharing options...
fenway Posted June 16, 2010 Share Posted June 16, 2010 Why would you even want to? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.