0

i'm trying to make a while in my multidimensional array like this:

$address = array();
while(!$res->EOF)
{
    $dataFromDB = array($res->fields['CODCLI'] => 
                     array(
                           "Address" => $res->fields['CIDCLI'].",".$res->fields['SIGUFS'].", USA", 
                           "Name"    => "SOMENAME")
                          );
    $address[]  = $dataFromDB;
    $res->MoveNext();
}

and the result is this:

Array
 (
   [0] => Array
      (
        [28947] => Array
            (
                [Address] => PIRIPIRI,PI,USA
                [Name] => SOMENAME
            )
      )
 )

but what i realy need is to come like this:

Array
(
  [1] => Array
    (
        [Address] => PIRIPIRI,PI,USA
        [Name] => SOMENAME
    )
)

i try some other stuffs, but nothing help me, what i'm missing?

1 Answer 1

1

Remove that 1st step, just do this:

$address[]  = array(
   "Address" => $res->fields['CIDCLI'].",".$res->fields['SIGUFS'].", USA", 
   "Name"    => "SOMENAME"
);
Sign up to request clarification or add additional context in comments.

1 Comment

actually the codcli have a value my mistake on posting

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.