You are here: Re: Inserting NULL into a smalldatetime « PHP SQL « IT news, forums, messages
Re: Inserting NULL into a smalldatetime

Posted by Rik on 09/30/73 11:51

Techie123 wrote:
> To get to the point, I'm currently facing a problem with the
> smalldatetime datatype. I can't INSERT a NULL value. The best I can
> get so far is having 01/01/1900 00:00:00 AM show up.
>
> The field is already set to accept NULL values and I can insert them
> manually by creating a new line with nothing in the smalldatetime
> fields or using ctrl+0, but when I try to do the following I get an
> error:

> <?php
> $qryStr = "INSERT INTO OPSCenterISS (EventTypeID, EventStatus,
> EventTitle, Location, AffectedUsers, EventDescription, StartDateTime,
> EndDateTime, Contact, Organization, SubmitDateTime )
> VALUES ( '$typeidinput', '$statusinput', '$titleinput', '$locinput',
> '$affectedinput', '$descinput', '$startdatetime', 'NULL',
> '$contactinput', '$orginput', '$submitdatetime' )"
> or die ("Error in ODBC Write");
> odbc_prepare ($sqlconnect, $qryStr);
> odbc_exec($sqlconnect, $qryStr);


What if you try to write NULL instead of 'NULL'.
Now you're trying to add the string 'NULL' to the database instead of a
NULL, which the database won't like if it's supposed to be a date format.

Grtz,
--
Rik Wasmus

 

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

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