그래서 내 데이터베이스 (icposts
, 아래)에 주석을 추가하려고하는데 결과가 없습니다. 당겨서 직접 데이터베이스 테이블에 삽입하는 주석을 표시 할 수 있지만 html 폼에서 주석을 보내려고하면 전혀 작동하지 않는 것 같습니다. 여기 localhost에서 내 데이터베이스에 주석 달기
<?php
$connect=mysqli_connect("localhost","root","");
$database=mysqli_select_db("icposts");
$username=$_POST['poster'];
$title=$_POST['postTitle'];
$body=$_POST['postText'];
$date=$_POST['currentDate'];
$submit=$_POST['submit'];
if($submit)
{
$query=mysql_query("INSERT INTO 'posts'('id', 'username', 'title', 'body', 'date') VALUES ('','$username','$title','$body','$date')");
}
?>
는 참조 용으로 폼의 HTML입니다 :
<form name="input" action="comments.php" method="POST">
\t Username: <input id = "poster" type="text" name="poster"value="Guest" /><br>
\t Tite: <input id = "postTitle" type="text" name="postTitle" /><br>
\t Comment: <br> <textarea id = "postText" name = "postText"rows="4" cols="50"></textarea>
\t <input id = "submit" name = "submit" type="submit" value="Submit" />
\t <input id = "currentDate" name = "currentDate" type = "hidden" value = "" />
</form>
도움을 주셔서 감사합니다! 임무를 위해이 작업을 수행하고 있으며 페이지가 안전 할 필요는 없지만 향후 프로젝트에서 SQL 주입을 염두에 두겠습니다. –
쉐인을 도와 주셔서 감사합니다. 그것을 해결 된 것으로 표시하는 것을 기억하십시오 * 환호성 * –