March 10, 2012

Filling array with data from one specified MySQL field

Question by Michael Sanders

The field:
Friends, and contains something like “2,3,6,3,67,97”
the numbers are user ID’s.

i want to know if there is a way to get those numbers into an array?

Thanks in advance

Answer by Starx

Use explode() method

$data = "2,3,6,3,67,97";
$dataarray= explode(",",$data);

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!