RE: [PHP-DB] ALTER TABLE - code not working.
| From: | Matt Williams | Date: | Fri, 30 Mar 2001 07:56:00 +0000 |
| Subject: | RE: [PHP-DB] ALTER TABLE - code not working. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-8026@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Martin E. Koss [mailto:mek@mek.co.uk]
> Sent: 29 March 2001 15:32
> To: Manuel Lemos; php-db@lists.php.net
> Subject: RE: [PHP-DB] ALTER TABLE - code not working.
> $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);
>
I believe you SQL is wrong, you forgot to set the column type.
ie. ALTER TABLE vips ADD COLUMN $NewCol VARCHAR(32)
etc....
M@