创建“徽章"对我的网站而言,存储用户徽章的最佳方法是什么?使用PHP [英] Creating "Badges" for my site, best way to store user badges? Using PHP

查看:99
本文介绍了创建“徽章"对我的网站而言,存储用户徽章的最佳方法是什么?使用PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网站上添加了徽章",我想知道存储数据的最佳方法是什么.每个徽章将具有一个存储在MySQL数据库中的ID.每个用户在MySQL数据库中都有自己的行,并且每个用户都有一个XML格式的"userdata"文件.因此,我可以将其保存在该XML文件中,也可以在用户"行中创建一个新列,并将其保存为"0; 5; 6; 4;". (徽章ID).

I am adding "Badges" to my web site, and I am wondering what the best way to store the data would be. Each badge will have an ID that is stored in a MySQL database. Each user has their own row in the MySQL database, and they each have a "userdata" file that is in XML format. So I could save it in that XML file, or I could create a new column in the "users" row and save them like "0;5;6;4;" (Badge IDs).

推荐答案

我在网站上也做类似的事情.而且我还没有一个结论性的答案.但不要像0; 5; 6; 4

Im doing similar with a webiste. And I've yet to come across a conclusive answer. But don't store the badges like 0;5;6;4

取而代之的是名为user_badges的表

Instead have a table called user_badges

Table user_badges
     user_id
     badge_id

并有一张徽章桌

 Table badges
    badge_id
    badge_name
    ..
    etc

这篇关于创建“徽章"对我的网站而言,存储用户徽章的最佳方法是什么?使用PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆