<?php
require_once('../conn.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta chaeset="utf-8">
<title>Web</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body>
<header>
<h1><a href="../index.php">Web</a></h1>
</header>
<nav>
<ol>
<?php
$sql = "SELECT * FROM `topic`";
$result = mysqli_query($conn,$sql);
while($row=mysqli_fetch_assoc($result)){
echo '<li><a href="http://localhost/index.php?id='.$row['id'].'">'.htmlspecialchars($row['title']).'</a></li>'."\n";
}
?>
</ol>
</nav>
<article>
<?php
$sql = "SELECT * FROM `topic` WHERE `id`=$id";
$result = mysqli_query($conn,$sql);
$row2=mysqli_fetch_assoc($result);
?>
<form class="" action="modify_check.php" method="POST">
<p>
<label for="title">제목 :</label>
<input type="text" name="title" id="title" value="<?php echo $row2['title'];?>">
</p>
<p>
<label for="description">본문</label>
<textarea id="description" rows="8" cols="40" name="description" value="<?php echo $row2['description'];?>"></textarea>
</p>
<p>
<input type="submit" value="제출">
</p>
</form>
</article>
</body>
</html>
이거인데 글 수정하려고 mysql에서 글 테이블 id를 불러오려고 했는데 안되... 어떻게 해야되 ㅠ 도와줘 형들
PHP에서 url query 로 넘긴 파라메터 걍 $variable 로 받는 거 최신 버전에선 기본적으로 막혀있을 걸? 보안 위협이어서.
$id 대신 ".$_GET['id']." 해 봐. 근데 이것도 SQL 인젝션 위험이 있어서 별로 좋은 코드는 아닌데 되긴 할 거임.
안되네...ㅠㅠ
ㅅㅅㅅ 아는척극혐
ㄴ 맞춤법 교정 : 아는척 > 아는티
미치게따... 이거땜에 진도를 못나간다 ㅠㅠ