Forum Moderators: coopster

Message Too Old, No Replies

comma separated values in mysql column

how to separte csv values in mysql field

         

Jose52

4:57 pm on Jun 29, 2012 (gmt 0)

10+ Year Member



What is the easiest way to echo the contents of a mysql field/column that contains comma separated values. For example, the field contains apples,jam,peaches. I want generate a keyword menu that echos out these values in this keyword column as individual words as delimited by the commas. This is probably an easy solution, but I have never had to do this before. Thanks in advance for any advice.

coopster

5:17 pm on Jun 30, 2012 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



explode?
[php.net...]

Jose52

5:24 pm on Jun 30, 2012 (gmt 0)

10+ Year Member



Thanks coopster. So treat the variable as an array and explode it?

incrediBILL

9:25 pm on Jul 7, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Exploding the variable creates the array, then iterate the resulting array with foreach().