這是測試代碼,我知道 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 的記錄,如您所愿。
- 1 回答
- 0 關注
- 105 瀏覽
添加回答
舉報
0/150
提交
取消