dongxia8656 2019-02-21 18:30
浏览 26

ISSET中的PHP调用函数检查[重复]

I am trying to call a function from within an ISSET check in PHP.

If I try this below it doesn't work:

function UpdateWIP(){
        $link = mysqli_connect(DB_SERVER,DB_USER,DB_PASSWORD,DB_DATABASE);
        $sql = "update wip_attribute_xref wx left join wip_ship_tran w ON w.wip_id = wx.wip_id  set wx.attribute_value = '" . $_POST['flowtag'] . "' where w.wip_ship_tran_id = " . $id . " and wx.attribute_name = 'FLT_TAG'"; 
        $result = mysqli_query($link, $sql) or die(mysql_error());
}

if(isset($_POST['process']) && isset($_GET['url'])){
    if (strlen($_POST['flowtag'])==10){
        UpdateWip();
        header('Location: wip_ship_csr.php?id=' . urlencode($id) . '&cdid=' . urlencode($cdid) . '&sn=' . urlencode($serialnumber));
    }else{
        echo "MISMATCH";
    }
}elseif(isset($_POST['cancel']) && isset($_GET['url'])){
    header('Location: wip_ship_search.php');
}

But if I do it the below way, it does work. Why? And how can I fix the first way?

if(isset($_POST['process']) && isset($_GET['url'])){
    if (strlen($_POST['flowtag'])==10){
        $link = mysqli_connect(DB_SERVER,DB_USER,DB_PASSWORD,DB_DATABASE);
        $sql = "update wip_attribute_xref wx left join wip_ship_tran w ON w.wip_id = wx.wip_id  set wx.attribute_value = '" . $_POST['flowtag'] . "' where w.wip_ship_tran_id = " . $id . " and wx.attribute_name = 'FLT_TAG'"; 
        $result = mysqli_query($link, $sql) or die(mysql_error());
        header('Location: wip_ship_csr.php?id=' . urlencode($id) . '&cdid=' . urlencode($cdid) . '&sn=' . urlencode($serialnumber));
    }else{
        echo "MISMATCH";
    }
}elseif(isset($_POST['cancel']) && isset($_GET['url'])){
    header('Location: wip_ship_search.php');
}
</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 java如何提取出pdf里的文字?
    • ¥100 求三轴之间相互配合画圆以及直线的算法
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 自己瞎改改,结果现在又运行不了了
    • ¥15 链式存储应该如何解决