[HELP] How to store date into sql.

Discussion in 'PHP' started by proxywhereabouts, Mar 8, 2010.

  1. #1
    Can someone help me teach how to store a timestamp into a sql?
    I mean can anyone show me an example codes for this?

    What I'm trying to achieve here is that when user submit a form, it get the date and store it in sql.

    Please help, thanks.
     
    proxywhereabouts, Mar 8, 2010 IP
  2. javaongsan

    javaongsan Well-Known Member

    Messages:
    1,054
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    128
    #2
    use NOW() in your sql statement
     
    javaongsan, Mar 8, 2010 IP
  3. samyak

    samyak Active Member

    Messages:
    280
    Likes Received:
    7
    Best Answers:
    4
    Trophy Points:
    90
    #3
    You can either use a NOW() in your SQl or actually get a date using time() function in PHP and save it in database.
     
    samyak, Mar 8, 2010 IP
  4. proxywhereabouts

    proxywhereabouts Notable Member

    Messages:
    4,027
    Likes Received:
    110
    Best Answers:
    0
    Trophy Points:
    200
    #4
    <form name="myform" action="myform.php"  method="get">
    My official email: <input name="email" class="input1" type="text" size="31" maxlength="50" /> <br /><br />
    My full name: <input name="name" class="input1" type="text" size="31" maxlength="50" /> <br /><br />
    My address:<textarea class="input1"  name="address" cols="24" rows="4"></textarea><br /><br /><br /><br /><br /><br />
    My contact number: <input name="number" class="input1"  type="text" size="31" maxlength="50" /> <br /><br />
    <input name="action" type="hidden" value="confirm" />
    <input name="reset" type="reset" value="Reset"><input name="submit" type="submit" value="Submit">
    </form>
    Code (markup):
    Where should I put the NOW() or time() in the form above?
     
    proxywhereabouts, Mar 9, 2010 IP
  5. skywebsol

    skywebsol Well-Known Member

    Messages:
    161
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #5
    this is html code only you have to put NOW() into sql query written in php code. i mean where you insert data query is present.
     
    skywebsol, Mar 9, 2010 IP