0

I have an entery in a MySQL table that looks similar to this...

1234567899, 3216549877, 6549873211, 9876543214, 1472583699

... and when I retrieve it with PHP it comes back as ...

Array([0] => 1234567899, 3216549877, 6549873211, 9876543214, 1472583699)

I shouldn't have any trouble with this, but my brain is farting and I can't figure it out! How do I get the individual values?

Justin White
  • 714
  • 7
  • 22

2 Answers2

3

Exploding the value should do the trick:

http://php.net/explode

Brendan Smith
  • 346
  • 2
  • 5
0

You can use explode() an example that would work for you is this:

$mysql_result = "1234567899, 3216549877, 6549873211, 9876543214, 1472583699";
$array = explode(", ",$mysql_result);

foreach($array as $key=>$value){
    echo $value."<br />";
    //$value will equal each of the elements that are seperate by a comma and a space above
}
/*

Result will look like this:
1234567899
3216549877
6549873211
9876543214
1472583699
*/
Mattisdada
  • 979
  • 1
  • 15
  • 24