MySQL Forums
Forum List  »  Newbie

Cant change column value
Posted by: Jason Kaczmarsky
Date: December 11, 2006 02:35PM

Alright, any column I create I can't change the value of.

First I create the table:
mysql_query("CREATE TABLE table(blank INT)") or die(mysql_error());

blank is just a temporary column since I don't know how many columns I'll be adding and you can't have an empty table.

Then I create the column:
mysql_query("ALTER TABLE table ADD COLUMN column INT") or die(mysql_error());

This works fine. At this point the column has no value.

Then I change the column value:
mysql_query("UPDATE table SET column=val") or die(mysql_error());

Now, when I check the value of that column, it shows nothing. Whats wrong?

Edited 1 time(s). Last edit at 12/11/2006 02:39PM by Jason Kaczmarsky.

Options: ReplyQuote

Written By
Cant change column value
December 11, 2006 02:35PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.