How do I insert a date into mysql as a parameter?

后端 未结 2 1791
既然无缘
既然无缘 2021-01-21 18:38

I have the following code:

function dbInsert()
{
    global $dbcon, $dbtable;
    global $inputData;

    $sqlQuery = \'INSERT INTO \' . $dbtable . \' (id_author         


        
2条回答
  •  后悔当初
    2021-01-21 19:18

    You can use a date/time column

    http://dev.mysql.com/doc/refman/5.1/en/date-and-time-types.html

    and use the STR_TO_DATE function:

    http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_str-to-date

    Or you can convert it to a unix timestamp and insert this one in an INT Column.

提交回复
热议问题