dt246813579 2016-05-22 22:38 采纳率: 0%
浏览 40

存储两个表之间没有第三个表的值

I have 2 SQL tables that have

  1. INT [post_id] INT [view_count] -> post_views table
  2. STR [user_ip] DateTime [date] INT [entries] -> users table

So I get user ip and check if this ip in base and it's date is outdated (1 day ago), then i update the date or ignore call, then if this ip is not in base, i add it to base and update view_count of some post from where update request with ip is come from.

Problem is that, how to check what post_id user have seen, and if this post_id have not been seen, then update it's view count value, or ignore if this user seen it that day.

How to store in user table which post_id's user have been seen in the best way? Maybe just add to user table column like viewed_posts as STR and store there post id's separated by comma? STR [viewed_id_list] -> [1,5,9]

Maybe there is better way than code/decode post id's in such new column?

I'm using php 5.4 with PDO for SQL transactrions.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 关于大棚监测的pcb板设计
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用