Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2014
    Posts
    44

    Unanswered: Filling generated today's date from PHP to Oracle DB

    Hi,

    I am having problem when automatically inputting todays date to oracle. what i have is this

    PHP Code:
    if (isset($_POST['submit']))
       {  
            
    date_default_timezone_set('Asia/Hong_Kong');
            
    $date date("d-m-Y"time());
            
            
    $s oci_parse($conn"INSERT INTO MASTER_DRAWING
                  (REV_DATE, REV_NO, HEAD_MARK, COMP_TYPE, QTY, WEB, FLANGE, WEB_THICK, FLANGE_THICK, WEIGHT, LENGTH, SURFACE)
                   VALUES (
    $date, '0',:hm, :ct, :qt, :wb, :fl, :wbt, :flt, :wt, :ln, :sf)"); 
    I keep getting this message

    Warning: oci_execute(): ORA-00932: inconsistent datatypes: expected DATE got NUMBER in C:\xampp\htdocs\WeltesInformationCenter\input.php on line 124

    Please help me

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    Quote Originally Posted by chrishutagalung View Post
    Hi,

    I am having problem . . .
    Obviously this is not a valid Oracle date, what did you expect?:
    PHP Code:
    . . .
            
    $date date("d-m-Y"time()); 
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    on a previous post someone has already shown you how to use dates in Oracle.
    however I'd suggest instead of using PHP to set the current date use a native Oracle function to set the date based on the time of the Oracle server
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Mar 2014
    Posts
    44
    Quote Originally Posted by healdem View Post
    on a previous post someone has already shown you how to use dates in Oracle.
    however I'd suggest instead of using PHP to set the current date use a native Oracle function to set the date based on the time of the Oracle server
    I got that working... THANKS HEALDEM !

Posting Permissions

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