Welcome Guest, Not a member yet? Register   Sign In
display mysql_result in table with modifications
#1

[eluser]mandril[/eluser]
Hi !

I want to display some data from a query in a table, im using the CI library and works great, but i want to add some modifications to the table im showing.. i want to add a new column with a link or.. add a link to the Id.

This is my code of the view:

Code:
<p>Usuarios:</p>
&lt;?php $this->table->set_heading('ID', 'Usuario', 'Clave', 'Email');
$tmpl = array ( 'table_open'  => '<table border="0" cellpadding="2" cellspacing="1">' );
$this->table->set_template($tmpl);

  foreach($results->result() as $dato):
    $array[0] = anchor('usuario/form/'.$dato->id, 'id');
    $array[1] = $dato->usuario;
    $array[2] = $dato->clave;
    $array[3] = $dato->email;  
  endforeach;
  
  echo $this->table->generate($array);

echo $this->pagination->create_links(); ?&gt;

Ok i know the problem, but don't know how to solve it.. the $results is the CI_mysql_result Object and i can generate a table from it using:

Code:
$this->table->generate($results);

But i want to add that modification and so use the generation from array, but without losing pagination. So with a foreach i can get the information and create the link in the id. but when i generate the table it only generates the first, this is because im always replacing my arrays position with other values.

Can someone help me with this ?


Messages In This Thread
display mysql_result in table with modifications - by El Forum - 01-21-2009, 10:57 PM
display mysql_result in table with modifications - by El Forum - 01-22-2009, 08:22 AM
display mysql_result in table with modifications - by El Forum - 01-22-2009, 08:47 AM
display mysql_result in table with modifications - by El Forum - 01-22-2009, 08:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB