Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2006
    Location
    USA
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combining Form Variables

    Okay, hopefully this is an easy one. I have a form on which a user can select a date in one field and a time in another. I need to combine these two variables into a single datetime variable to put in the database. I've looked all over and can't seem to find any good info on this. Everything else I am sending to the database works just fine.

    Here is what doesn't work [it throws a parser error]:
    Code:
    <?php
    $db_host = "*****";
    $db_user = "*****";
    $db_pwd = "*****";
    $db_name = "contentdb";
     
    mysql_connect($db_host, $db_user, $db_pwd) or die('Could not connect to mysql server: '. mysql_error()); 
    mysql_select_db($db_name) or die('Could not select database: '. mysql_error());
     
    $publishdatetime = $_GET["publishdate"] + $_GET["publishtime"];
     
    $result = mysql_query("insert into main_articles (publishdatetime) values ('$publishdatetime');
     
    mysql_close();
    ?>
    • Jesus called. He says He misses you.

  • #2
    New Coder
    Join Date
    Aug 2006
    Location
    Idaho
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts
    .
    + Christ is the Rock - Rock On!

  • #3
    New Coder
    Join Date
    Sep 2006
    Location
    USA
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's just what I needed. Thanks Scriptbanger.
    • Jesus called. He says He misses you.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •