//二维数组模拟你的数据库 相当于mysql_fetch_array($result)查出来的数据,当然查出来是一维的 我们现在把他格式化为二维
<html>
<head>
<?php
$table[]=array(
"user"=>"aaaa",
"count"=>"22",
"timeset"=>"1310344207",
"id"=>"1"
)
$table[]=array(
"user"=>"bbbb",
"count"=>"33",
"timeset"=>"1310344208",
"id"=>"2"
)
</head>
<body>
<table width="300" align="center">
<tr>
<td>用户名<td>
<td>登录次数<td>
<td>登录时间<td>
<td>id<td>
</tr>
<?php foreach($table as $value) { ?>
<tr>
<td><?= $value['user']?><td>
<td><?=$value['count']?><td>
<td><?=$value['timeset']?><td>
<td><?=$value['id']?><td>
</tr>
<?php } ?>
</table>
</body>
</html>
是不是你想要的结果?
把while($row=
mysql_fetch_array($result,MYSQL_ASSOC))
改成while($row
=
mysql_fetch_array($result,MYSQL_NUM))这个就行了,
具体的去查下mysql_fetch_array这个函数就行了
如果我的回答没能帮助您,请继续追问。
直接存数组里的字符串就行了。如$a="0,1,2,3,"或$a=join(",",array(0,1,2,3))
mysql_query("INSERT INTO admin (monday) VALUES($a)")
这样字段monday的就是0,1,2,3,
读取的时候要重新组成数组的话就分割重组。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)