dongqindan4406 2017-06-21 06:28
浏览 42

php和js中使用datepicker的语法错误

Well hello there. I have this problem where I can't figure out where the syntax error is with my dateTimePicker. please help here is the form its in

<form name="subExpdate" method="POST" action="" id="subExpdate" >
                            <input type="date" id="expDatePicker" name="expDatePicker" style="margin-bottom: 5px" >
                            <input type="hidden" value="<?php echo $prodLink->valueof('link_id') ?>" id="hidID" name="hidID">
                            <input type="hidden" name="prodInt" id="prodInt" value="<?php echo $selInterface; ?>"/>
                            <button class="btn btn-success" type="button" name="changeExpireDate" id="changeExpireDate" onclick="changeExpireDate23()" >Change expire date</button>
                        </form>  

Here is my function:

function changeExpireDate23() {
        var expTime = new FormData(document.getElementById('subExpdate'));
        console.log('something' + expTime);
        $.ajax({
        url: "my path and it works not allowed to show",
                type: 'POST',
                data:expTime,
                contentType: false,
                processData: false, 
                success: function (data) {
                alert(data);
                        console.log(data);
                }
    });
    }

and here is my ajax page :

 if (isset($_POST['expDatePicker'])){
            $datePicker = date('d/m/Y  H:i:s' , strtotime($_POST['expDatePicker']));
            $getLinkData = new CGenRs("SELECT * FROM lu_product_link WHERE link_id = '" . $hidid . "' ", $cao_beta2);
            $getLinkData->first();

            $updateExpDate = "UPDATE lu_product_link SET (link_promo_expiry) = '".$datePicker."' WHERE link_id = '".$hidid."'";
            if($cao_beta2->execute($updateExpDate)){
                echo 'SUCCESS date updated';
            } else{
                echo 'Failed sorry mate';
            }

please if you can help me it would be much appreciated. thanks in advance.

  • 写回答

1条回答 默认 最新

  • douyun1860 2017-06-21 06:45
    关注

    I found the problem it was this line

    $updateExpDate = "UPDATE lu_product_link SET (link_promo_expiry) = '".$datePicker."' WHERE link_id = '".$hidid."'";
    

    The (link_promo_expiry) should not have been in ()

    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测