发布和取消发布问题

时间:2019-04-14 21:32:55

标签: php

我在后端有这部分代码:

if (isset($_GET['publish']) || isset($_GET['unpublish'])) {
$message = "";
if (isset($_GET['publish'])) {
    $message = "Post published successfully";
    $post_id = $_GET['publish'];
} else if (isset($_GET['unpublish'])) {
    $message = "Post successfully unpublished";
    $post_id = $_GET['unpublish'];
}
togglePublishPost($post_id, $message);

}


function togglePublishPost($post_id, $message)
{
global $conn;
$sql = "UPDATE posts SET published=!published WHERE id=$post_id";

if (mysqli_query($conn, $sql)) {
    $_SESSION['message'] = $message;
    header("location: posts.php");
    exit(0);
    }
}

当我尝试发布来自“ https://....posts.php?publish=36”的帖子时,页面令人耳目一新,没有任何反应。错误文件中也没有日志。.请帮助我。.

P.S:如果我尝试取消发布该帖子,也是如此。 PHP v7.0

1 个答案:

答案 0 :(得分:-1)

=ARRAYFORMULA(SUBSTITUTE(SUBSTITUTE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(IF(LEN(A1:A), SUBSTITUTE( REGEXREPLACE({"Lyrics", "Visualizer", "Bass Boost", "8D", "Nightcore", "Image Only"}, REGEXREPLACE(A1:A, ", ", "|"), ), " ", "♦"), )),,999^99))), " ", ", "), "♦", " ")) 替换为<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=HERE&amp;libraries=places"></script> <script> google.maps.event.addDomListener(window, 'load', initialize); function initialize() { var input = document.getElementById('autocomplete_search'); var autocomplete = new google.maps.places.Autocomplete(input); autocomplete.addListener('place_changed', function () { var place = autocomplete.getPlace(); // place variable will have all the information you are looking for. $('#lat').val(place.geometry['location'].lat()); $('#long').val(place.geometry['location'].lng()); }); } </script> <title>Google Places Autocomplete InputBox Example Without Showing Map - Tutsmake.com</title> <style> .container{ padding: 10%; text-align: center; } </style> </head> <body> <div class="container"> <div class="row"> <div class="col-12"><h2>Google Places Autocomplete InputBox Example Without Showing Map</h2></div> <div class="col-12"> <div id="custom-search-input"> <div class="input-group"> <input id="autocomplete_search" name="autocomplete_search" type="text" class="form-control" placeholder="Search" /> <input type="hidden" name="lat"> <input type="hidden" name="long"> </div> </div> </div> </div> </div> </body> </html> ,像这样:

(!published)