dongtingxiao4697 2015-02-16 17:54
浏览 110
已采纳

在php和mysql中评论系统

I write script and form for comment for my movie website but I don't know how to store each comment in his table column in database for specyfic movie.

for example, I have to movies on this image http://prntscr.com/65wilp So, I want when I post comment on movie 95ers Time Runners 2013 to store that comment in column for that movie, and comment for Guardians of the Galaxy 2014 in his column.

Thanks

  • 写回答

1条回答 默认 最新

  • doure8758 2015-02-16 18:08
    关注

    You need more database tables. Learn more about relationships. You need two tables. Movie_table and comments_table. The relationships between two is 1:N. This says, The ONE movie has a MANY comments.

    Try put hidden input to the comment form named movie_id. If you list movies from Movie_table you can fill this input with a correct ID of movie row. Next, if you send the comment, you know the id of movie and you can make the relation of comment to movie (via foreign keys).

    this can help you to make tables http://www.databaseprimer.com/pages/relationship_1tox/

    and this can make you get more skills https://howtoprogramwithjava.com/database-relationships-one-to-many/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算