I have been trying to get a new column added to a table (vips) via a PHP
script, but having exhausted all the things I can find, I'm still
struggling. I've referred to TFM for all those who just can't wait to tell
me
to do so, and I believe my SQL statement is correct:
$NewCol = $Prod_Code;
$defaultvalue = "0.00";
// make usual connection
$conID = mysql_pconnect ("localhost","admin","mek1233");
mysql_select_db("FocusDynamics", $conID);
// set the query
// According to the mySQL manual:
// ALTER TABLE vips ADD column_name FLOAT (11,2) DEFAULT '0.00'
// So I used:
$AddColQuery = "ALTER TABLE vips ADD $NewCol FLOAT (11,2) DEFAULT '0.00'";
$result = mysql_query ($AddColQuery,$conID);
// now set the default value for all rows in vips table
$SetDefault = "UPDATE TABLE vips SET $NewCol=$defaultvalue";
$result = mysql_query ($SetDefault,$conID);
It is NOT adding the column, and obviously not setting the default.
Any help would be great, 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]
--
PHP General 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]