I need to show some data in two colums, I make a search and find some things and I try. I think that what I do It works but I was rong, works partially.
This is my database
**Type**
--------
id_type | type
------------|------------
1 | first Title
2 | second Title
3 | Third Title
**Content**
---------
id_content | content | id_type
-----------|-----------|---------
1 | Content1 | 1
2 | Content2 | 2
3 | Content3 | 2
4 | Content4 | 3
5 | Content5 | 3
6 | Content6 | 3
my model
$query1 = "select * from type";
$query2 = "select * from content where id_type = $id_type";
Note: this query goes in ther respective function
my controller
$list_content = array(array());
$contador = 0;
$list_type = array(array());
$cont_type = 0;
$query1 = $obj->Search_Type();
for ($j = 0; $j < $query1->num_rows; $j++) {
$id_type = $list_type[$cont_type]['id_type'] = $query1->row($j)->id_type;
$query2 = $obj->Search_Content($id_type);
for ($i = 0; $i < $query2->num_rows; $i++) {
id_content = $list_content[$contador]['id_content'] = $query2->row($i)->id_content;
$list_content[$contador]['id_type'] = $query2->row($i)->id_type;
$contador++;
} //end for i
$list_type[$cont_type]['id_receptor'] = $id_content;
$cont_type++;
}//del for j
in my view
<table border='1'>
<?php $columna = 1;
for ($j = 0; $j < $cont_type; $j++) {
if ($list_type[$j]['id_type'] != '') {
?>
<tr>
<td colspan = '2'>
<?php echo $list_tipo_receptor[$j]['tipo_receptor_TVD']; ?>
</td>
</tr>
<?php
}// if type no empty
for ($i = 0; $i < $contador; $i++) {
if ($list_type[$j]['id_type'] == $list_content[$i]['id_type']) {
if ($columna == 1) {
?>
<tr>
<?php } ?>
td> <?php echo $list_content[$i]['id_content']; ?></td>
<?php if ($columna != 1) { ?>
</tr>
<?php
$columna = 1;
}// if columna != 1
else {
$columna++;
}// else
}//if
} //for i
}// for j
?>
</table>
this show this result
-------------------------
| First Title |
-------------------------
|Content1 | |
-------------------------
| Second Title |
-------------------------
|Content2 | |
-------------------------
|Content3 | |
-------------------------
| Third Title |
-------------------------
|Content4 | |
-------------------------
|Content5 | Content6 |
and I want to show me some like this
-------------------------
| First Title |
-------------------------
|Content1 | |
-------------------------
| Second Title |
-------------------------
|Content2 | Content3 |
-------------------------
| Third Title |
-------------------------
|Content4 | Content5 |
-------------------------
| Content6 | |
Thanks for your help.

