亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么我的代碼不能正確顯示評論和回復?

為什么我的代碼不能正確顯示評論和回復?

PHP
森林海 2021-06-18 18:27:36
這是測試代碼,我知道 sql 注入以及如何修復它們。這是一個很長的問題要解釋,所以我會盡力而為。這些是我的數據庫中的列contentid (auto increments with every post, comment, and reply)hostid (gets the value of the person who uploaded the original post)postid (gets the value of the post, auto increments with every post)userid (gets the value of the person who commented or replied)date (gets the current time)title (gets the title of the post entered by the host)description (gets the description of the post entered by the host)fileid (describes the type of post ex. video, picture, or blog)commentid (auto increments with every comment)comment (the actual comment entered by a user)replyid (auto increments with every reply)reply (the actual reply entered by a user)我正在開發一個帖子系統,該系統允許用戶發布內容,然后對帖子發表評論或回復帖子中的評論。我有一個名為 posts 的數據庫,其中包含所有帖子的評論和回復。如果數據庫中沒有與帖子具有相同 postid 值的評論,則不應回顯任何內容。如果數據庫中沒有與之前評論具有相同 postid 和 commentid 的回復,則不應回顯任何內容。換句話說,如果沒有評論或回復,則不應彈出任何內容。我看到了實際的帖子,但我的數據庫中有評論和回復沒有顯示,有什么想法嗎?
查看完整描述

1 回答

?
慕尼黑8549860

TA貢獻1818條經驗 獲得超11個贊

看起來這部分... AND postid = 'postid' AND ...應該是... AND postid = '$postid' AND ...

您的查詢正在查找具有postid ==(字符串)“postid” 而不是 postid ==(值)$postid 的記錄,如您所愿。


查看完整回答
反對 回復 2021-06-25
  • 1 回答
  • 0 關注
  • 105 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號