123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- $banner = $_POST['banner'];
- $link = $_POST['link'];
- $banner_one = $_POST['banner_one'];
- $link_one = $_POST['link_one'];
- $banner_two = $_POST['banner_two'];
- $link_two = $_POST['link_two'];
- $type = 'banner';
- include_once("../../untils/conn.php");
- if ($con) {
- mysqli_query($con, "set names utf8");
-
- // 查询数据库中的记录数
- $result = mysqli_query($con, "SELECT COUNT(*) FROM system WHERE id=1");
- $row = mysqli_fetch_row($result);
- $num_rows = $row[0];
-
- if ($num_rows == 0) {
- // 如果记录数为0,说明数据库中没有数据,执行插入新数据的操作
- $data = $con->query("INSERT INTO system (banner, link, type, banner_one, link_one, banner_two, link_two) VALUES ('$banner', '$link', '$type', '$banner_one', '$link_one', '$banner_two', '$link_two')");
- } else {
- // 如果记录数不为0,说明数据库中已经存在数据,执行更新操作
- $data = $con->query("UPDATE system SET banner='$banner', link='$link', type='$type', banner_one='$banner_one', link_one='$link_one', banner_two='$banner_two', link_two='$link_two' WHERE id=1");
- }
-
- if ($data > 0) {
- echo "<script>alert('修改成功');window.location.href='../Bansytem.php'</script> ";
- } else {
- echo ("<script>alert('修改失败');window.location.replace(document.referrer)</script>");
- }
- }
- $con->close();
- ?>
|