/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
include_once "config.php";
$username = $_POST['username'];
$content = $_POST['content'];
$time_at = time();
$sql = "INSERT INTO wish (
username ,
content ,
time_at
)
VALUES (
'$username','$content', '$time_at')";
$result = $conn->query($sql);
if($result){
$ret = array();
$sql = "select * from wish where username='$username' and time_at='$time_at'";
$result = $conn->query($sql);
$arrlist = array();
if ($result->num_rows > 0) {
// 输出每行数据
while($row = $result->fetch_assoc()) {
array_push($arrlist, $row);
}
}
$ret["data"] = $arrlist[0];
$ret["status"] = 1;
}else {
$ret["status"] = 0;
}
echo json_encode($ret);
//header("location:index.php");
一键复制
编辑
Web IDE
原始数据
按行查看
历史