OK, I have some PHP/MySQL experience but not enough to say I am an expert - or even an advanced intermediate.
I have a routine that gets the input from a form and attempts to put it into a database. However, I cannot figure out how to send NULL for the time - and, yes, the DB has a default of NULL and allows NULL.
So, I have an array called $values that stores the various form input. One input is called ‘eventStarttime’ and can be null. I then build the query format using the code below. However, I cannot get the NULL that is put in the $values[‘eventStarttime’] variable to actually be put int the db. I get 00:00:00 in the db.
Please let me know how I can get the NULL to be inserted into my db.
$myQuery = "INSERT INTO Events ";
$fieldNames ="(";
$fieldValues ="(";
foreach( $values as $key => $whatsin){
if (trim($key) != 'task')
{
$fieldNames .= $key.",";
$fieldValues .= "'".$whatsin."',";
}
}
$myQuery .= $fieldNames."eventActive, eventSpecial, eventInputDate) VALUES ".$fieldValues."'1','0','".date('Y-m-d')."')";