Nebster
Nebster

Reputation: 914

QCubed how to save QDateTime as NULL

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.

Upvotes: 0

Views: 399

Answers (1)

Harshith Cariappa
Harshith Cariappa

Reputation: 79

This will work.

$dataobject = new TableName();
$objProject->Finished = null;
$dataobject->Save(); 

Upvotes: 0

Related Questions