0

my QCubed PHP class "Project" has a property called "Finished" which is object of QDateTime and data type "datetime" in MySQL database. I need to save NULL into database when user leaves this field blank in HTML <input type="datetime-local" name="Finished" /> but I cannot find a way for it since PHP always throws Internal Server Error 500

if ($_GET["Finished"] != "") $objProject->Finished = new QDateTime($_GET["Finished"]);
else $objProject->Finished = ??? 

Will be glad for any help.

Nebster
  • 884
  • 1
  • 11
  • 19
  • Nevermind, I found the answer. Problem was somewhere else, my bad. You can simply do `$objProject->Finished = null;` and it will work. – Nebster Apr 18 '16 at 14:22

1 Answers1

0

This will work.

$dataobject = new TableName();
$objProject->Finished = null;
$dataobject->Save(); 
  • example: if u want to save value into the table in qcubed u have to create its object first $dataobject = new TableName(); // creating the object of `tablename` $dataobject->Item = null; // This will assign the value `null`. where `Item` should not be `not null` in the database. $dataobject->Save(); // this shoud be written to save the data into the table – Harshith Cariappa Feb 21 '17 at 10:04