delete columns

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jaymoore_299
Forum Contributor
Posts: 128
Joined: Wed May 11, 2005 6:40 pm
Contact:

delete columns

Post by jaymoore_299 »

is it possible to delete a column from a table in mysql using php?
If not, how can I make sure that column is empty and then copy all the other columns to a different table, then delete the first table?
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post by Skara »

Code: Select all

ALTER TABLE 'table' DROP 'column'
jaymoore_299
Forum Contributor
Posts: 128
Joined: Wed May 11, 2005 6:40 pm
Contact:

Post by jaymoore_299 »

thanks, how about adding a column?
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Code: Select all

ALTER TABLE `db`.`table`
  ADD COLUMN `NewField` int(11) NULL;

ALTER TABLE `db`.`table`
  DROP COLUMN `NewField`;
Post Reply