You are here: Re: update a row with value null (mysql db) « All PHP « IT news, forums, messages
Re: update a row with value null (mysql db)

Posted by J.O. Aho on 11/04/06 17:06

nawfer wrote:
> if the table mysql has 4 field so:
> ID int(11) NOT NULL auto_increment,
> camp2 varchar(10) NOT NULL default '',
> camp3 int(11) NULL default '',
> camp4 varchar(10) NULL default '',
> PRIMARY KEY (ID),
> KEY camp3 (camp3)
>
>
> why it does not make me to update camp3 and 4 with a value null or ''
> do not work:
> UPDATE $my_var_tabella
> SET camp3 = '', camp4 = ''
> WHERE ID = $my_var_number
>
> also writing
> SET camp3 = NULL, camp4 = NULL not work
> where is the error?
>
> instead if I insert some data it works:
> SET camp3 = $id_number, camp4 = $name_text
>
> not want '' or NULL, even if with CREATE TABLE I have insert in
> camp3 and 4 this '' how default

Do a table like this instead:
> ID int(11) NOT NULL auto_increment,
> camp2 varchar(10) default '',
> camp3 int(11) default '',
> camp4 varchar(10) default '',
> PRIMARY KEY (ID)


And you should get rid of you troubles.

KEY and NULL don't work that well together.


//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация