二维数组储存至数据库有关问题

WBOY
Release: 2016-06-13 13:24:24
Original
1331 people have browsed it

二维数组储存至数据库问题
我想将一个二维的数组的值储存到mysql数据库中不知如何做,例:
字段:name age sex
数组:array(array(sh,20,男),array(se,30,女));

------解决方案--------------------
serialize()

序列化.

 使用的时候还原一下
unserialize()
------解决方案--------------------
$ar = array(array('sh',20,'男'),array('se',30,'女'));
foreach($ar as $v) {
mysql_query("insert into 表 (name, age, sex) values ('$v[0]', $v[1], '$v[2]')");
}

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