douyingzhan5905 2012-12-04 00:31
浏览 70
已采纳

如何根据订阅或计费传递或显示mySQL数据

I want to build a PHP based site where, the user can view data based on the types of data they've paid for.

Allow me to use something simple for an example.

Let's say historical data for basketball was not readily available but could be purchased. Simple information such as the Winner, Loser, Final score and date are all stored in a mySQL table.

What would be involved so that, when the user logs in, they can only see the historical data they have paid for.

My theories so far about the architecture:

I imagined a mySQL table storing True or False values for all historical game data they have paid for. Based on this, a 'data chart' object enables the user to view all data within their mySQL row which has a value of 'true.'

Follow ups:

Assuming I am correct, what methods are popular or practical for this type of service.

  • 写回答

1条回答 默认 最新

  • dongliu8542 2012-12-04 23:03
    关注

    If we're going with the sporting paradigm...

    Every game needs to have a unique ID. Then you have a table of customers, each also with a unique ID. Then you have a table that describes who paid for what. A table with two columns of ID's, customerID and gameID. This is what is called normalization.

    So, in your joining table you might have CUSTOMER ID 001, who have paid for games 001, 003, and 005. Here is the customer table:

    .------------------------------.
    | customer_id | customer_name  |
    |------------------------------|
    | 001         | SPM, Inc.      |
    | 002         | Stack Overflow |
    '------------------------------'
    

    Here is the game table:

    .---------------------------------.
    | game_id     | description       |
    |---------------------------------|
    | 001         | Giants v. Red Sox |      |
    | 002         | Blah v. Yada      |
    | 003         | Vader v. Kenobi   |
    | 004         | Romney v. Obama   |
    | 005         | Roth v. Hagar     |
    '---------------------------------'
    

    Here is the table that corresponds to who paid for what:

    .-----------------------------.
    | customer_id | game_id       |
    |-----------------------------|
    | 001         | 001           |
    | 001         | 003           |
    | 001         | 005           |
    | 002         | 002           |
    | 002         | 005           |
    '-----------------------------'
    

    Notice how the ID's in the last table are not unique.

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

报告相同问题?

悬赏问题

  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多