Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在研究一个从数据库调用记录的小型 php 脚本。我正在使用这段代码:`mysql_query("select * from kalimat where cat=$id order by id");
` 如果数据库中不存在猫 ID,我想将用户重定向到 404 错误页面!
你可以这样尝试:-
$name = mysql_query("select * from kalimat where cat=$id order by id"); if (!$name) { header('HTTP/1.0 404 Not Found'); die(); }