0
저는 지금 당분간 내 웹 사이트의 관리자 측에서 작업하고 있습니다.delete.php 페이지 DB 콘텐츠를 삭제하지 않습니다.
mysql의 mobi DB에 항목을 추가 할 페이지를 성공적으로 만들었습니다.
그러나 delete.php 페이지를 추가 할 때 매우 효과적이지 않습니다.
드롭 다운 메뉴에서 DB의 모든 기사를로드하고 나열하지만, 더 이상 필요하지 않은 항목을 선택하면 페이지의 코드로 색인화되지만 내 사이트는 삭제되지 않습니다. 기사. 내가 잘못 가고 어디 사람이
<?php
session_start();
include_once('../include/connection.php');
include_once('../include/article.php');
$article = new storearticle;
if (isset($_SESSION['logged_in'])) {
if (isset($_GET['title'])) {
$id = $_GET['title'];
$query = $pdo->prepare('DELETE FROM mobi WHERE promo_title = ?');
$query->bindValue(1, $title);
$query->execute();
header('Location: index.php');
}
$articles = $article->fetch_all();
?>
<html>
<head>
<title>Delete Article</title>
<link rel="stylesheet" href="../other.css" />
</head>
<body>
<div class="container">
<a href="index.php" id="logo"><b>← Back</b></a>
<br />
<div align="center">
<h4>Select an article to delete:</h4>
<form action="delete.php" method="get">
<select onchange="this.form.submit();" name="title">
<?php foreach ($articles as $article){ ?>
<option value="<?php echo $article['promo_title']; ?>"><?php echo $article['promo_title']; ?></option>
<?php } ?>
</select>
</form>
</div>
</div>
</body>
</html>
<?php
} else {
header('Location: index.php');
}
?>
을 볼 수
내 DELETE.PHP 페이지는이 무엇입니까?
추가 정보가 필요하면 알려주십시오.
당신은 print_r ($ articles); .. – user20232359723568423357842364
안녕하세요 사용자 ... 나는 아래에 명시된 바와 같이 $ id를 $ title로 변경했습니다. 감사. – kevstarlive