dozrhldy285751 2014-08-28 13:32
浏览 6
已采纳

if语句导致白屏[关闭]

i have the if statement below i am trying to make sure that the variable client2 is not empty before doing the update, as the update has to be performed to that client, but ever time i uncomment the if statement it gives a white screen

if(!empty($client2)
    {
        mysqli_query($con,$query) or die ("Could not update ");
        header('Location: preview.php?=client=$client');
    }

what i would like is for it not to produce a white screen i suspect it is minor error i have overlooked

the problem also existed before i added

    header('Location: preview.php?=client=$client');

this was added as it the final step it needs to do after doing the update but i will have to add a check in to display the error if it fails the update before doing the header but for now i am focusing on getting it to do the update regardless of mysql errors

  • 写回答

2条回答 默认 最新

  • douke8473 2014-08-28 13:39
    关注

    You do miss a closing bracket in your if. Empty is a function and needs to be opened and closed with brackets (). As is the IF function. In other words, you don't close your IF function so PHP assumes that everything after emtpy() is still part of the IF closure.

    Also, try never working (in development env ofc) without display_error being abled.

    Besides that, your header function has a '=' after the question mark. Its not needed and will eventually fail.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 iOS绕地区网络检测
  • ¥15 python验证码滑块图像识别
  • ¥15 根据背景及设计要求撰写设计报告
  • ¥15 QT6颜色选择对话框显示不完整
  • ¥20 能提供一下思路或者代码吗
  • ¥15 用twincat控制!
  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 单通道放大电路的工作原理
  • ¥30 YOLO检测微调结果p为1
  • ¥15 DS18B20内部ADC模数转换器