dousidan1279 2014-09-24 19:05
浏览 34
已采纳

PHP到Oracle日期警告[关闭]

I am receiving a ORA-00917: missing comma warning at the line marked below, which infers that this is occurring in my query. However, I have gone over my query a lot of times and cannot seem to locate this "missing comma". Thank you for your time. "Warning: oci_execute() [function.oci-execute]: ORA-00917: missing comma in"

if(isset($_POST['submit']))
{
     $db = oci_connect('user', 'password, "server/host");
     $Notes = kFile($_POST["notes"]);
     if(empty($_POST["composite"])){$composite = "No";}else{$composite = "Yes";}
     $techName = $_POST['techName'];
     $setupDate = $_POST['setupdate'];
     $removalDate = $_POST['removaldate'];
     $startDate = $_POST['startdate'];
     $stopDate = $_POST['stopdate'];
     $sampleLocation = $_POST['samplelocation'];
     $serialN = $_POST['serialn'];
     $filterN = $_POST['filtern'];
     $initialFlow = $_POST['initialflow'];
     $timerStop = $_POST['timerstop'];
     $finalFlow = $_POST['finalflow'];  
     $timerStart = $_POST['timerstart'];
     $finalWeight = $_POST['finalweight'];
     $temperature = $_POST['temperature'];
     $initialWeight = $_POST['initialweight'];
     $atmPressure = $_POST['atmpressure'];
     $filterLoad = $_POST['filterload'];

     $query = "INSERT INTO DATA(
                                                TECHNICIAN_NAME,
                                                SAMPLE_LOCATION,
                                                SERIAL_NUM,
                                                FILTER_NUM,
                                                START_DATE,
                                                START_TIME,
                                                STOP_DATE,
                                                STOP_TIME,
                                                INITIAL_FLOW,
                                                FINAL_FLOW,
                                                TIMER_STOP,
                                                TIMER_START,
                                                FINAL_WEIGHT,
                                                INITIAL_WEIGHT,
                                                TEMPERATURE,
                                                ATM_PRESSURE,
                                                COMMENTS,
                                                NOT_IN_COMPOSITE,
                                                FILTER_LOAD,
                                                SET_UP_DATE,
                                                REMOVAL_DATE)
                                                VALUES(
                                                :name, :sample, :serial, :filter, TO_DATE(:startDate, 'mm/dd/yyyy'), TO_DATE(:startTime, 'mm/dd/yyyy'),
                                                TO_DATE(:stopDate, 'mm/dd/yyyy'), TO_DATE(:stopTime, 'mm/dd/yyyy'), :initialFlow, :finalFlow, :timerStop,
                                                :timerStart, :finalWeight, :initialWeight, :temperature, :atmPressure,
                                                :comments, :composite, :filterLoad, TO_DATE(:setup, 'mm/dd/yyyy'), TO_DATE(:removal, 'mm/dd/yyyy'))";

    $compiled = oci_parse($db, $query);

    oci_bind_by_name($compiled, ':name', $techName);
    oci_bind_by_name($compiled, ':sample', $sampleLocation);
    oci_bind_by_name($compiled, ':serial', $serialN);
    oci_bind_by_name($compiled, ':filter', $filterN);
    oci_bind_by_name($compiled, ':startDate', $startDate);
    oci_bind_by_name($compiled, ':startTime', $startDate); //redundant check db
    oci_bind_by_name($compiled, ':stopDate', $stopDate);
    oci_bind_by_name($compiled, ':stopTime', $stopDate); //redundant check db
    oci_bind_by_name($compiled, ':initialFlow', $initialFlow);
    oci_bind_by_name($compiled, ':finalFlow', $finalFlow);
    oci_bind_by_name($compiled, ':timerStop', $timerStop);
    oci_bind_by_name($compiled, ':timerStart', $timerStart);
    oci_bind_by_name($compiled, ':finalWeight', $finalWeight);
    oci_bind_by_name($compiled, ':initialWeight', $initialWeight);
    oci_bind_by_name($compiled, ':temperature', $temperature);
    oci_bind_by_name($compiled, ':atmPressure', $atmPressure);
    oci_bind_by_name($compiled, ':comments', $kosterNotes);
    oci_bind_by_name($compiled, ':composite', $composite);
    oci_bind_by_name($compiled, ':filterLoad', $filterLoad);
    oci_bind_by_name($compiled, ':setup', $setupDate);
    oci_bind_by_name($compiled, ':removal', $removalDate);

    oci_execute($compiled); //warning occurs here
    echo "Did I execute?";
}

Thanks for looking.

  • 写回答

2条回答 默认 最新

  • douzai8285 2014-09-24 19:17
    关注

    It looks like you're missing the last parenthesis in the query; the one that will enclose the VALUES list:

    $query = "INSERT INTO ... VALUES(..., TO_DATE(:removal, 'mm/dd/yyyy')";
                                        need one more parenthesis here  ^
    

    Fixed:

    $query = "INSERT INTO ... VALUES(..., TO_DATE(:removal, 'mm/dd/yyyy'))";
                                                             here it is  ^
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题