通过“按国家/用户偏好"通过PHP分隔MySQL内容.基础 [英] Separating MySQL content via PHP on a "per-country/user preference" basis
问题描述
好吧,我将对此进行简单介绍:
Okay, I'll lay this out simply:
我有一个包含内容的数据库,但我需要设置一个条件,如果用户选择了英国而不是美国(反之亦然),则不会显示某些内容.可以通过后端中的复选框来应用此条件.
I have one database that has content in it but I need to set up a conditon where if the user has selected Britain instead of the U.S. or vice versa -- some content will not show. This condition can be applied via a checkbox in the backend like so.
在[x]英国[x]美国演出你好,我是一个段落"
"Hello, I'm a paragraph" show in [x] Britian [x] U.S.
我没有考虑实际的IP地址或此类地址,因为该站点将根据用户在索引页面上的选择直接重定向到root/uk或root/us子文件夹.我将在db或php中加入什么样的唯一参数?
I'm not looking into actual IP Addresses or anything of that sort as the site will simply redirect to root/uk or root/us subfolders upon the user's selection on the index page. What kind of a unique parameter would I have incorporate in the db or php?
谢谢!
推荐答案
Add a column in the database display_content, make it a EMUN and set the values to 'britain','usa','all' then make the adjustments in your code to check for Britain/USA. you can either choose to display all, Britain or USA.
这篇关于通过“按国家/用户偏好"通过PHP分隔MySQL内容.基础的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!