php - Single row explode with loop -


i have data stored in single column mysql db this:

1-yizle-smallpic-this pretty cool-2-user-smallpic-testing!1-yizle-smallpic-this pretty cool-2-user-smallpic-testing!- 

now want output data in loop , need loop every 4 hyphens, data output be

$uid,$username,$userpicurl,$comment.. 

the code have far, works, returns first occurrence.

foreach($result->fetch_assoc() $v){     list($uid, $username, $userpicurl, $comment) = explode("-", $v); print "$uid $username $userpicurl $comment"; } 

foreach($result->fetch_assoc() $v) {     $parts = explode("-", $v);     ($i = 0; $i < count($parts); $i+=4) {         list($uid, $username, $userpicurl, $comment) = array_slice($parts, $i, 4);         print "$uid $username $userpicurl $comment";     } } 

Comments

Popular posts from this blog

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -