在单个MYSQL单元格中插入多个值 [英] Inserting multiple values in a single MYSQL cell

查看:120
本文介绍了在单个MYSQL单元格中插入多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以建议我如何使用Php在单个MySQL单元中存储多个值吗? 我只是在使用insert函数,但它根本没有帮助.

Can anyone suggest me how can i store Multiple values in a single MySQL cell using Php? I am simply using the insert function but it is not helpfull at all.

推荐答案

不,不,不,不!

永远不要在单个单元格中存储多个值.它会始终与您联系.它违反了数据库规范化的第三条规则.

No, no no, no, NO!

Never store multiple values in a single cell. It will always get back to you. It is against the 3rd rule of DB normalization.

在单元格中仅插入单个值,并根据需要添加多个记录.例子

Insert only single values in a cell and add multiple records if you must. Example

photos table:          id  | filename
                       1   | 'myfoto.jpg'

comments table:       photo_id | user_id  | comment
                      1        | 23       | 'great picture'
                      1        | 99       | 'nice'
                      1        | 7        | 'do not like it'

这篇关于在单个MYSQL单元格中插入多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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