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

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -