I have found that I can NOT do this: $null = "NULL" or even $null = NULL than put that into a statement like this: UPDATE games SET game_id = '$null'; can't do it like this either UPDATE games SET game_id = $null; I have to do it like this: UPDATE games SET game_id = NULL; NO QUOTES of any kind. Somebody else might have a way around this. In that case, I would like to hear it too. That would let me get around the following:
$searchStmt = "UPDATE games SET date = '$date', time = '$time',"; if($loc_id == ""){$searchStmt .= "loc_id = NULL,";}else{$searchStmt .= "loc_id = '$loc_id',";} if($hteam_pt == ""){$searchStmt .= "hteam_pt = NULL,";}else{$searchStmt .= "hteam_pt = '$hteam_pt',";} if($vteam_pt == ""){$searchStmt .= "vteam_pt = NULL,";}else{$searchStmt .= "vteam_pt = '$vteam_pt',";} if($sea_id == ""){$searchStmt .= "sea_id = NULL,";}else{$searchStmt .= "sea_id = '$sea_id',";} if($hteam == ""){$searchStmt .= "hteam = NULL,";}else{$searchStmt .= "hteam = '$hteam',";} if($vteam == ""){$searchStmt .= "vteam = NULL,";}else{$searchStmt .= "vteam = '$vteam',";} if($hteam_forfeit == ""){$searchStmt .= "hteam_forfeit = NULL,";}else{$searchStmt .= "hteam_forfeit = '1',";} if($vteam_forfeit == ""){$searchStmt .= "vteam_forfeit = NULL,";}else{$searchStmt .= "vteam_forfeit = '1',";} if($official_1 == ""){$searchStmt .= "official_1 = NULL,";}else{$searchStmt .= "official_1 = '$official_1',";} if($official_2 == ""){$searchStmt .= "official_2 = NULL,";}else{$searchStmt .= "official_2 = '$official_2',";} if($official_3 == ""){$searchStmt .= "official_3 = NULL,";}else{$searchStmt .= "official_3 = '$official_3',";} if($official_4 == ""){$searchStmt .= "official_4 = NULL,";}else{$searchStmt .= "official_4 = '$official_4',";} if($official_5 == ""){$searchStmt .= "official_5 = NULL ";}else{$searchStmt .= "official_5 = '$official_5' ";} $searchStmt .= "where game_id = '$game_id'" ; The previous is in a PHP script calling a MySQL DB. Steve At 12:22 PM 5/10/2002, raphael k wrote: >I created a table with a field define as NULL, however when I insert >values NULL , Mysql puts 0 instead of nothing , > >I don't understand why I have this trouble , > > > >Thanks > > > >--------------------------------------------------------------------- >Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > >To request this thread, e-mail <[EMAIL PROTECTED]> >To unsubscribe, e-mail <[EMAIL PROTECTED]> >Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php