简体   繁体   中英

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

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');
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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