日期:2014-05-17  浏览次数:20638 次

php如何根据格式写入数据库并读出来???
HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<style>
body{
    margin:0px; padding:0px; font-size:12px;
}
input{
    float:left; margin-right:5px; width:100px; height:18px; line-height:18px; border:1px solid #f00;
}
.form{
    margin:50px auto 0px; width:600px; overflow:hidden;
}
.form div{
    margin-bottom:10px; clear:both; overflow:hidden;
}
.btn{
    width:50px; height:22px; text-align:center; line-height:22px;
}

</style>
<body>

<div class="form">
<form id="form" name="form" action="" method="post" enctype="multipart/form-data">
<div>
<input type="text" name="postdb[sku_name][1_50]" value="" />
<input type="text" name="postdb[sku_sku][1_50]" value="" />
<input type="text" name="postdb[sku_price][1_50]" value="" />
<input type="text" name="postdb[sku_shopid][1_50]" value="" />
<input type="text" name="postdb[sku_storage][1_50]" value="" />
</div>

<div>
<input type="text" name="postdb[sku_name][1_55]" value="" />
<input type="text" name="postdb[sku_sku][1_55]" value="" />
<input type="text" name="postdb[sku_price][1_55]" value="" />
<input type="text" name="postdb[sku_shopid][1_55]" value="" />
<input type="text" name="postdb[sku_storage][1_55]" value="" />
</div>
<div>
<input type="text" name="postdb[sku_name][7_60]" value="" />
<input type="text" name="postdb[sku_sku][7_60]" value="" />
<input type="text" name="postdb[sku_price][7_60]" value="" />
<input type="text" name="postdb[sku_shopid][7_60]" value="" />
<input type="text" name="postdb[sku_storage][7_60]" value="" />
</div>
<div>
<input type="text" name="postdb[sku_name][7_65]" value="" />
<input type="text" name="postdb[sku_sku][7_65]" value="" />
<input type="text" name="postdb[sku_price][7_65]" value="" />
<input type="text" name="postdb[sku_shopid][7_65]" value="" />
<input type="text" name="postdb[sku_storage][7_65]" value="" />
</div>

<input type="submit" name="submit" class="btn" value="提交" />
</form>
</div>

当:
postdb[sku_name][1_50]=黑色   postdb[sku_sku][1_50]=M    postdb[sku_price][1_50]=100    postdb[sku_shopid][1_50]=1000    postdb[sku_storage][1_50]=mj1 

postdb[sku_name][1_55]=黄色   postdb[sku_sku][1_55]=X    postdb[sku_price][1_55]=77     postdb[sku_shopid][1_55]=1000    postdb[sku_storage][1_55]=mj2

postdb[sku_name][7_60]=绿色   postdb[sku_sku][7_60]=L    postdb[sku_price][7_60]=55     postdb[sku_shopid][7_60]=1000    postdb[sku_storage][7_60]=mj3 

postdb[sku_name][7_65]=红色   postdb[sku_sku][7_65]=S    postdb[sku_price][7_65]=90     postdb[sku_shopid][7_65]=1000    postdb[sku_storage][7_65]=mj4

时,在php文件中如何写入数据库 shopinfo 字段里 格式是这样的,(目前我只提取4条做为参考,但是可能有N条!)

黑色/M/100/1000/mj1/@@