【发布时间】:2011-11-14 12:21:42
【问题描述】:
我最近创建了一个 PHP/MySQL 评论系统,直到几个小时前它还在工作(代码完全没有变化)。当我告诉提交表单代码回显查询时,它显示缺少评论文本和日期的区域。我不明白为什么。这是我的代码:
mysql_connect("localhost","commentUser","password"); mysql_select_db("cmets"); $name = mysql_real_escape_string($_POST['name']); $postID = mysql_real_escape_string($_POST['postId']); if(!is_numeric($postID)) 出口(); $email = mysql_real_escape_string($_POST['email']); $comment = strip_tags(mysql_real_escape_string($_POST['comment']), ''); $date = mysql_real_escape_string($_POST['date']); if($email == '' || $comment = '' || $date = '') 出口(); $query = "INSERT INTO cmets (PostID,Name,Email,Text,Date) VALUES($postID, '$name', '$email', '$comment', '$date')"; mysql_query($query) 或死(mysql_error()); mysql_close(); 回声“ window.location = \"sn-p.php?id=$postID\"; ";【问题讨论】:
-
您应该发布表单的 HTML 代码
-
能把html表单的代码贴一下吗?
-
是帖子中的单等号错别字还是实际代码中的错别字? if($email == '' || $comment = '' || $date = '') 应该都是双等号。