M Greeds
M Greeds

Reputation: 3

PHP: Alter table but only in special columns

How can I add a column to only a specific user. if for an example i would like to add a new column but only to id 3.

Here is the code that i'm using:

$add = "ALTER TABLE $db_chest_name ADD kg_$countt INT(11) NOT NULL WHERE id='$myid'";
        mysql_query($add) or die ('could not alter ' . mysql_error());

Upvotes: 0

Views: 30

Answers (1)

GautamD31
GautamD31

Reputation: 28763

ALTER by default will add the column to the table not corresponding with the rows.If you want you can implement the logic on creating a column with default value and update it for the user whom you want.

Upvotes: 1

Related Questions