简体   繁体   English

如何更改echo Error Query以重定向404.php?

[英]How to Change echo Error Query to redirect 404.php?

When i test this code , It's show 当我测试此代码时,它显示

Error Query [SELECT * FROM table WHERE xxxxxx != '1' order by id xxxxxx ]

Yes, It's correct 是的,没错

But i want to change from error text to redirect to 404.php 但是我想从错误文本更改为重定向到404.php

how can i do ? 我能怎么做 ?

$strSQL = "SELECT * FROM table WHERE xxxxx != '1' order by id xxxxxx";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");

You can do this. 你可以这样做。

$objQuery = mysql_query($strSQL);
if(!$objQuery){
    header('Location: 404_page.php');
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM