The following assumes you've already selected the database and that $column contains the name of the new column and $defaultvalue is the value to be set. $query = "ALTER TABLE Prices ADD $column DEFAULT \"$defaultvalue\""; mysql_query($query) or die("Can't add column to Prices"); $query = "UPDATE TABLE Prices SET $column=$defaultvalue"; mysql_query($query) or die("Can't update table Prices"); And, yes, you are a bit lazy...<GRIN> This is in the manual. -----Original Message----- From: Martin E. Koss [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 13, 2001 12:22 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] add a column to a table via PHP Hi, I'm probably being a bit lazy asking what I should be able to figure out, but here goes anyway: What I want to do, in response to certain other actions having taken place, is add a column to a mySQL database (FocusShop) table (Prices) and set the default value of that column and update all existing rows in that table to the same value for that new column. Has anyone got the correct way to do this? Thanks, Martin. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]