mysql怎么给一个表中插入一个字段这个字段会随机生成一个唯一码

WBOY
Release: 2016-06-13 13:35:53
Original
1043 people have browsed it

mysql如何给一个表中插入一个字段这个字段会随机生成一个唯一码
mysql如何给一个表中插入一个字段这个字段会随机生成一个唯一码

------解决方案--------------------
如果用php的话可以用uniqid()生成唯一id,再用字符串函数处理一下写入字段
用mysql的话,可以结合rand,md5生成一定程度上的唯一值

SQL code
INSERT `table` (`column`) VALUES (LEFT(MD5(RAND()),5)); <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!