Compare commits

...

2 Commits

Author SHA1 Message Date
ef1ca1c48c
fix error_reporting 2023-11-25 20:48:00 +08:00
ba05834015
fix when id is empty 2023-11-25 20:47:24 +08:00
2 changed files with 3 additions and 1 deletions

@ -1,4 +1,5 @@
<?php <?php
error_reporting(0);
//设置json格式头部 //设置json格式头部
header('Content-type: application/json'); header('Content-type: application/json');
//载入数据库文件 //载入数据库文件
@ -7,7 +8,7 @@ require("data.php");
if (isset($_GET['id'])) { if (isset($_GET['id'])) {
$id = $_GET['id']; $id = $_GET['id'];
//查询指定id的记录 //查询指定id的记录
$sql = "SELECT * FROM soul WHERE id = $id"; $sql = "SELECT * FROM soul WHERE id = $id+0";
} else { } else {
//查询随机一条记录 //查询随机一条记录
$sql = "SELECT * FROM soul ORDER BY RAND() LIMIT 1"; $sql = "SELECT * FROM soul ORDER BY RAND() LIMIT 1";

@ -1,4 +1,5 @@
<?php <?php
error_reporting(0);
ob_start(); ob_start();
session_start(); session_start();
require("data.php"); require("data.php");