while($row = mysql_fetch_array($result))
此刻我的$ row ['content']里面有四个字符串,我怎么才能让它们进入数组中的单独对象?
如0>“第一个”
1>“第二个字符串” 等等
此刻他们都捆绑成一个似乎...但我需要他们分隔在一个数组中。
我是PHP的新手,并花了很多时间试图找出如何做到这一点。
在此先感谢。
print_r($ row ['content']);
返回:
的hello world另一个oneand另一个...更多即将... $行的回报
VAR转储:
阵列(4){[0] =>字符串(1)“1”[“id”] =>字符串(1)“1”[1] =>字符串(12)“hello world!” [“content”] => string(12)“hello world!” } array [4] {[0] => string(1)“2”[“id”] => string(1)“2”[1] => string(11)“another one”[“content”] => string(11)“another one”} array(4){[0] => string(1)“3”[“id”] => string(1)“3”[1] => string(18 )“和另一个...”[“content”] => string(18)“and another one ...”} array(4){[0] => string(1)“4”[“id” ] => string(1)“4”[1] => string(14)“more coming ...”[“content”] => string(14)“more coming ...”}
var_dump($ row)'show? – 2012-07-28 18:02:12
'explode(“\ n”,$ row ['contents'])'? – 2012-07-28 18:03:24
你能否添加一些关于你的数据库模式的信息? – Thomas 2012-07-28 18:04:33