Welcome Guest, Not a member yet? Register   Sign In
Get the generated value of a loop
#1

[eluser]masentinel900[/eluser]
I'm selecting some values from a DB for put them in a dynamic table. Next of generate the table with four(4) rows get from the db, I need get the value generate of each one row for may to do the appropiate download..

This is the controller.

Code:
foreach($query->result() as $row)
  {  
   $datos = array(
   'idacta' => $row->idacta,
   'rutaarchivo' => $row->rutaarchivo,
   'descripcion' => $row->descripcion,
   'fechademodificacion' => $row->fechademodificacion,
   );
   for($i>1; $i<=$datos['idacta']; $i++)
   {  
   $content .= "  
   <tr>
    <td id='$i'>&lt;input name='opcion-res' type='radio' align='center'/&gt;&lt;/td>
    <td id='$i'><a href='download'>$datos[rutaarchivo]</a></td>
    <td id='$i'>$datos[descripcion]</td>
    <td id='$i'>$datos[fechademodificacion]</td>
    &lt;input id='$i' type='hidden' name='hola' value='$datos[rutaarchivo]'/&gt;
   </tr>
   ";
   }  
   $this->session->set_userdata('logged_content', $datos);
   $this->output->set_output($content);
  }

This is the side of my controller where I'm add the variables with the DB rows, I need get the variable of hidden input which content the route of the file for be downloaded. The second <th> have a link wich call the download controller and there I get the value of the route trought the userdata parameters..

If I have 20 files diferents and I try to download any always goes download me the last because is getting the route but outside of the foreach.

The question is : How I do for may get the dynamic variable inside of the loop?

I'm developing a space for downloads. Any suggestion or Idea please let me know..


Messages In This Thread
Get the generated value of a loop - by El Forum - 11-11-2012, 10:29 PM
Get the generated value of a loop - by El Forum - 11-11-2012, 11:35 PM
Get the generated value of a loop - by El Forum - 11-12-2012, 09:30 AM
Get the generated value of a loop - by El Forum - 11-12-2012, 10:44 AM
Get the generated value of a loop - by El Forum - 11-15-2012, 06:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB