Retrieve FOR loop variable inside a FOREACH - php

0

Hi, I have two links in the structure of my code. The first is a FOR that mounts an array with data. And I have a foreach that traverses some DB data.

I want to use the variable that returns in FOR and use in foreach, but it does not seem to be rolling.

Can anyone help me?

for($i=0 ; $i < $contador; $i++)
{
    $tbnewsletterNews = Doctrine_Core::getTable('tbnews')->createQuery('a')->select('a.*')->where('a.id = ?', $param['id_noticia'][$i])->execute();
    foreach($tbnewsletterNews as $news) 
    {
      if($news->getImagem() !== '')
      {
        $noticias[] = '<div class="col-md-9" style="display:block; width:670px; margin-left:15px;"> </div>';
      }else{
       $noticias[] =  '<div class="col-md-9" style="display:block; width:670px; margin-left:15px;"> </div>';
      }
    }
  $body .= '<div class="col-md-12 col-noticias">'. $noticias[$i] . '</div> ';
} 

    foreach ($usuarios as $usuario)
    {

     $corpo = '<img src="http://www.meusite.gov.br/images/informativoHeader.jpg"width="700" height="175" border="0" style="margin:0; margin-bottom:15px;"/><br><br>
                '.$body.'
                <img src="http://www.meusite.gov.br/images/rodape.jpg"border="0"/>'.$sair;
    }

I want to use that variable $ body there, but when saved in the database its contents are empty: T

    
asked by anonymous 16.12.2015 / 11:57

0 answers