基于mysql的bbs设计(二)_PHP
3。数据库设计
关键还是mysql的效率问题,合理分配mysql的内存,特别是table cache的
大小。另外,当系统突然掉电呢?mysql是否robust?
table的名字设计,采用一位前缀表明类型,全部用小写表示(?),例如:
系统的数据库,以s为前导,如用户表:suser(sUSER 呢?),具体如下:
s :系统表,suser,sclass
m :用户信件表,msysop,mdrangon
w :用户消息表,wsysop,wdrangon
a :版面索引表,alinux,acampus
b :版面文章表,blinux,bcampus
c :特殊分类版面表,cnewboard
i :精华区索引表,ilinux,ilinux01,icampus,icampus04
j :精华区文章表,jlinux,jcampus,
另外,是使用字串还是数字作为标识呢?例如,一个叫sysop的帐号,其
id是1,他的信的表是msysop还是m00001呢?同样,一个叫campus的版,对应的
代码是5,则这个版的文章的表名是bcampus还是b00005呢?可能用字串会容易
理解,查错吧。
用户信息表:suser
usernum int unique, // 唯一标识符,最多30000个帐号,会不会太少了?
userid char[20] primary key, // 排序的关键字,id,全小写。
passwd char[20], // 密码,存放加密后的密文。
realid char[20], // 实际id,大小写混合。
username char[24], // 用户的泥称
userlevel longint, // 64种权限?
numlogins int,
numposts int,
firstlogin time,
lastlogin time,
staytime time, /* 总共停留时间 */
lasthost char[32],
email varchar[100],
address varchar[100],
// 还需要其他数据吗?是否需要留出一定的保留值,以后alter table来
// 增加新的字段时,效率如何?
版面分类表:sclass
classnum int unique, // 分类标识
classid char[20], // 分类的英文id:computer
classname varchar[100],// 分类的中文描述:电脑世界
classtable char[20], // 特殊分类对应的版面表
// 一般来说,每个版面只属于一个分类,对于特殊分类,例如拳头版块,
// 新版面,可以用专门的表来描述
版面表:sboard
boardnum int unique, // 版面的标识(需要吗?)
boardid char[20], // 版面的英文名
boardname varchar[100], // 版面的中文名
boardclass char[20], // 版面所属分类
boardsysop varchar[100], // 斑竹名单
boardposts int, // 版面的文章数
boardlevel int, // 版面的读写权限
indextable char[20], // 版面对应的索引表的名称:aboardid?
texttable char[20], // 版面对应的文章表名称: bboardid?
// 最后两项有没有必要出现,是否可以作为必然对应关系,还是允许
// 出现更大的灵活性?另外版面的大小写问题是否可以直接默认
// 只开头字母大写,
特殊分类版面表:snewboard, sstarboard
boardid char[20], // 版面的id
// 这样的表有必要吗?
版面索引表:acampus,alinux,afootball。。。。。。
id int, // 文章序数,要手动调整????
mark char[1], // 文章标记,m,g,b,d。。。。
title varchar[100], // 文章标题
writer char[20], // 文章作者id
posttime time, // 发表时间
textnum longint, // 对应的编号???不调整
版面文章表
textnum longint, // 文章编号?
textword text, // 文章内容?
// 有必要将索引和文章内容分开吗?从效率上看,况且lazy flush
// 是必然的。删除也是先做个标记。
// 用户中的版面文章是否未读的数据比较繁,是否应该再建一堆的表
// 才能实现呢?
// 投票功能暂不考虑。。。。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



1. How can you make money by publishing articles on Toutiao today? How to earn more income by publishing articles on Toutiao today! 1. Activate basic rights and interests: original articles can earn profits by advertising, and videos must be original in horizontal screen mode to earn profits. 2. Activate the rights of 100 fans: if the number of fans reaches 100 fans or above, you can get profits from micro headlines, original Q&A creation and Q&A. 3. Insist on original works: Original works include articles, micro headlines, questions, etc., and are required to be more than 300 words. Please note that if illegally plagiarized works are published as original works, credit points will be deducted, and even any profits will be deducted. 4. Verticality: When writing articles in professional fields, you cannot write articles across fields at will. You will not get appropriate recommendations, you will not be able to achieve the professionalism and refinement of your work, and it will be difficult to attract fans and readers. 5. Activity: high activity,

According to news on April 26, ZTE’s 5G portable Wi-Fi U50S is now officially on sale, starting at 899 yuan. In terms of appearance design, ZTE U50S Portable Wi-Fi is simple and stylish, easy to hold and pack. Its size is 159/73/18mm and is easy to carry, allowing you to enjoy 5G high-speed network anytime and anywhere, achieving an unimpeded mobile office and entertainment experience. ZTE 5G portable Wi-Fi U50S supports the advanced Wi-Fi 6 protocol with a peak rate of up to 1800Mbps. It relies on the Snapdragon X55 high-performance 5G platform to provide users with an extremely fast network experience. Not only does it support the 5G dual-mode SA+NSA network environment and Sub-6GHz frequency band, the measured network speed can even reach an astonishing 500Mbps, which is easily satisfactory.

According to news on March 4, Kubi Rubik's Cube will launch the "Xiaoku Tablet 2Lite" tablet computer on March 5, with an initial price of 649 yuan. It is reported that the new tablet is equipped with Unisoc’s T606 processor, which uses a 12nm process and consists of two 1.6GHz ArmCortex-A75 CPUs and six ArmCortex-A55 processors. The screen uses a 10.95-inch IPS eye-protection screen with a resolution of 1280x800 and a brightness as high as 350 nits. In terms of imaging, Xiaoku Tablet 2Lite has a 13-megapixel main camera on the rear and a 5-megapixel selfie lens on the front. It also supports 4G Internet access/calls, Bluetooth 5.0, and Wi-Fi5. In addition, the official claimed that this tablet&l

According to news on April 17, HMD teamed up with the well-known beer brand Heineken and the creative company Bodega to launch a unique flip phone - The Boring Phone. This phone is not only full of innovation in design, but also returns to nature in terms of functionality, aiming to lead people back to real interpersonal interactions and enjoy the pure time of drinking with friends. Boring mobile phone adopts a unique transparent flip design, showing a simple yet elegant aesthetic. It is equipped with a 2.8-inch QVGA display inside and a 1.77-inch display outside, providing users with a basic visual interaction experience. In terms of photography, although it is only equipped with a 30-megapixel camera, it is enough to handle simple daily tasks.

According to news on July 12, the Honor Magic V3 series was officially released today, equipped with the new Honor Vision Soothing Oasis eye protection screen. While the screen itself has high specifications and high quality, it also pioneered the introduction of AI active eye protection technology. It is reported that the traditional way to alleviate myopia is "myopia glasses". The power of myopia glasses is evenly distributed to ensure that the central area of sight is imaged on the retina, but the peripheral area is imaged behind the retina. The retina senses that the image is behind, promoting the eye axis direction. grow later, thereby deepening the degree. At present, one of the main ways to alleviate the development of myopia is the "defocus lens". The central area has a normal power, and the peripheral area is adjusted through optical design partitions, so that the image in the peripheral area falls in front of the retina.

According to news on April 3, Taipower’s upcoming M50 Mini tablet computer is a device with rich functions and powerful performance. This new 8-inch small tablet is equipped with an 8.7-inch IPS screen, providing users with an excellent visual experience. Its metal body design is not only beautiful but also enhances the durability of the device. In terms of performance, the M50Mini is equipped with the Unisoc T606 eight-core processor, which has two A75 cores and six A55 cores, ensuring a smooth and efficient running experience. At the same time, the tablet is also equipped with a 6GB+128GB storage solution and supports 8GB memory expansion, which meets users’ needs for storage and multi-tasking. In terms of battery life, M50Mini is equipped with a 5000mAh battery and supports Ty

At work, ppt is an office software often used by professionals. A complete ppt must have a good ending page. Different professional requirements give different ppt production characteristics. Regarding the production of the end page, how can we design it more attractively? Let’s take a look at how to design the end page of ppt! The design of the ppt end page can be adjusted in terms of text and animation, and you can choose a simple or dazzling style according to your needs. Next, we will focus on how to use innovative expression methods to create a ppt end page that meets the requirements. So let’s start today’s tutorial. 1. For the production of the end page, any text in the picture can be used. The important thing about the end page is that it means that my presentation is over. 2. In addition to these words,

According to news on May 13, vivoX100s was officially released tonight. In addition to excellent images, the new phone also performs very well in terms of signal. According to vivo’s official introduction, vivoX100s uses an innovative universal signal amplification system, which is equipped with up to 21 antennas. This design has been re-optimized based on the direct screen to balance many signal requirements such as 5G, 4G, Wi-Fi, GPS, and NFC. This makes vivoX100s the mobile phone with the strongest signal reception capability in vivo’s history. The new phone also uses a unique 360° surround design, with antennas distributed around the body. This design not only enhances the signal strength, but also optimizes various daily holding postures to avoid problems caused by improper holding methods.
