How can I insert the date into only one field in my MySQL

  • Profile Image
    verex18
    Asked on December 31, 2012 at 02:38 AM

     I wanted to insert the date into my SQL database using your form,  but I can only insert it into different field in my database. Is there any way to insert the date into only one field in my database and able to retrieve the data back into my form.

  • Profile Image
    Welvin
    Answered on December 31, 2012 at 03:45 AM

    Hi,

    Using our date field and following the guide given on this page (http://www.jotform.com/help/126-How-to-Insert-Update-Submissions-to-Your-MySQL-Database-Using-PHP), you can accomplish such thing. Are you NOT able to create a table on your MySQL database for only the date field? 

     

    Thanks

  • Profile Image
    verex18
    Answered on December 31, 2012 at 09:04 PM

    Using your datetime, how to submit the date into only one field in my database, because the date  are separated into 3 different fields right ? Right now what I want is to insert the field into only one field in my database instead of 3 different field

  • Profile Image
    liyam
    Answered on January 01, 2013 at 12:43 AM

    You can merge the array keys and put it into one variable.

    Example:

    [DateTime] => Array ( [0] => 11 [1] => 24 [2] => 2013 [3] => 1 [4] => 34 [5] => PM )

    Your PHP code:

    $datetime = $_POST['DateTime']['2'] ."-". $_POST['DateTime']['0'] ."-". $_POST['DateTime']['1'] ." ". $_POST['DateTime']['3'] .":". $_POST['DateTime']['4'];

    This will make the value of the variable to:

    $datetime = "2012-11-24 1:34"

    Please let us know if you need further clarification.

    Thanks.