RE: [PHP-DB] ALTER TABLE - code not working.
| From: | Martin E. Koss | Date: | Thu, 29 Mar 2001 12:23:02 +0000 |
| Subject: | RE: [PHP-DB] ALTER TABLE - code not working. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-7968@lists.php.net to get a copy of this message | ||
yes, I have full access rights. Using the same user and password (for
example) as I use when using phpMyAdmin and have no problems altering tables
with that.
Martin.
-----Original Message-----
From: IceCold [mailto:icecold@cometacom.it]
Sent: 29 March 2001 13:18
To: Martin E. Koss
Subject: RE: [PHP-DB] ALTER TABLE - code not working.
Sorry but are you sure to have enought grant privilege to alter table?
------------------------------------
Cordiali Saluti.
Matteo Indorato
Cometa Comunicazioni S.r.L
------------------------------------
www.davide.it
Filtered Access to the NET
Obtain your account for free TODAY!!
------------------------------------
-----Original Message-----
From: Martin E. Koss [mailto:mek@mek.co.uk]
Sent: Thursday, March 29, 2001 1:21 PM
To: php-db@lists.php.net
Subject: [PHP-DB] ALTER TABLE - code not working.
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 t TFM for all those who just can't wait to tell me
to do so, and 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
$AddColQuery = "ALTER TABLE vips ADD COLUMN $NewCol";
$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: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net