vendredi 31 juillet 2015

Parse, format, and store as variable results from query

In PHP, I get this back:

array(1096) {
  [0]=>
  array(2) {
    ["exuid"]=>
    string(36) "c056b5ce-3b0c-4494-858a-cf184b904dc3"
    [0]=>
    string(36) "c056b5ce-3b0c-4494-858a-cf184b904dc3"
  }
  [1]=>
  array(2) {
    ["exuid"]=>
    string(36) "8a6262c6-a4e0-41a4-8a47-ecaf5f79c2d5"
    [0]=>
    string(36) "8a6262c6-a4e0-41a4-8a47-ecaf5f79c2d5"
  }
  [2]=>
  array(2) {
    ["exuid"]=>
    string(36) "728cb9b6-6240-470f-87d5-706af554cd0b"
    [0]=>
    string(36) "728cb9b6-6240-470f-87d5-706af554cd0b"
  }
  [3]=>
  array(2) {
    ["exuid"]=>
    string(36) "a26d0fdd-9a9b-4611-8c41-3d2c9b012988"
    [0]=>
    string(36) "a26d0fdd-9a9b-4611-8c41-3d2c9b012988"
  }  
    ETC

What I need to end up with is defining a variable that contains all the exuid returned separated by commas. Like this:

$something = 'c056b5ce-3b0c-4494-858a-cf184b904dc3', '8a6262c6-a4e0-41a4-8a47-ecaf5f79c2d5', '728cb9b6-6240-470f-87d5-706af554cd0b', 'a26d0fdd-9a9b-4611-8c41-3d2c9b012988'

I need it in this format to push into another query:

 where `exuid` in ($something)

But I can't parse this correctly. If I do var dump($result) I get the array shown above. If I do var dump($result[0]['exuid']) I get the first value back (c056b5ce-3b0c-4494-858a-cf184b904dc3), but not the others. How do I parse this and format it in the way I need it?

Aucun commentaire:

Enregistrer un commentaire