fix when id is empty

This commit is contained in:
Zichao Lin 2023-11-25 20:47:24 +08:00
parent ba26402705
commit ba05834015
Signed by: earthjasonlin
GPG Key ID: 406D9913DE2E42FB

@ -7,7 +7,7 @@ require("data.php");
if (isset($_GET['id'])) {
$id = $_GET['id'];
//查询指定id的记录
$sql = "SELECT * FROM soul WHERE id = $id";
$sql = "SELECT * FROM soul WHERE id = $id+0";
} else {
//查询随机一条记录
$sql = "SELECT * FROM soul ORDER BY RAND() LIMIT 1";