hjkhghoppoopppooppoppoppoopoirh
bnmbertsurheoppopopooooooooooooooopoopopdf'tdfg
/
home
/
u641149403
/
domains
/
cabz4you.com
/
public_html
/
admin
/
Upload FileeE
HOME
<?php include 'lib/core.php'; //Show All cities if($_SERVER['REQUEST_METHOD'] == "GET") { if (isset($_GET['show_cities'])) { $show = "SELECT * FROM not_working_cities"; $result = $conn->query($show); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $cities[] = $row; } echo json_encode($cities); } } } if($_SERVER['REQUEST_METHOD'] == "POST") { // Adding package cities if (isset($_POST['state_name'])) { // $city = $_POST['city_name']; $state = $_POST['state_name']; $sql = "INSERT INTO not_working_cities(city) VALUES('$state')"; if ($conn->query($sql)) { echo "Success"; } else { echo "Something Wrong"; } } //Show Current City in Edit Modal if (isset($_POST['city_id'])) { $id = $_POST['city_id']; $query = "SELECT * FROM not_working_cities WHERE id = " . $id; $result = $conn->query($query); if ($result->num_rows > 0) { $current_city = $result->fetch_assoc(); echo json_encode($current_city); } } //Updating package City in Modal if (isset($_POST['save_id'])) { $id = $_POST['save_id']; // $city = $_POST['save_city_name']; $state = $_POST['save_state_name']; $sql = "UPDATE not_working_cities SET city = '$state' WHERE id = $id"; if ($conn->query($sql)) { echo "Success"; } else { echo "Something Wrong"; } } //Delete package cities if (isset($_POST['delete_id'])) { $id = $_POST['delete_id']; $query = "DELETE FROM not_working_cities WHERE id = " . $id; if ($conn->query($query)) { echo "Success"; } else { echo "Something Wrong"; } } } ?>