Jump to content
Fórum Script Brasil
  • 0

indice do array não aparece


Carlos Rocha

Question

Olá pessoal.

Boa tarde.

Tenho o seguinte array:

Array
(
    [0] => Array
        (
            [id_prod] => 3
            [quan] => 1
            [id_lista] => 2
        )

    [2] => Array
        (
            [id_prod] => 6
            [quan] => 2
            [id_lista] => 2
        )

    [4] => Array
        (
            [id_prod] => 1
            [quan] => 3
            [id_lista] => 2
        )

)
Tenho um codigo para saber quais os valores que estão em [id_prod]. Porem o valor do indice 4 não esta vindo. Onde será que esta o erro?
for( $i = 0; $i < count( $dados ); $i++ )
                {
                    print "<br>".$dados[ $i ] [ 'id_prod' ]."oi";
                        if( !empty( $dados[ $i ] [ 'id_prod' ] ) )
                        {
                          $Query = sprintf( 'SELECT id FROM produtos WHERE id = %d', $dados[ $i ] [ 'id_prod' ] );
                          $R_Query = $MySQL->query( $Query );
                          if( mysql_num_rows( $R_Query ) > 0 )
                          {
                            $MeuCarrinho->AdicionarItem( $dados[ $i ] [ 'id_prod' ], $dados[ $i ] [ 'quan' ] , $dados[ $i ] [ 'id_lista' ] );
                          }
                         }
      
                  }
Edited by Carlos Rocha
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...