I have trouble outputting some queried data which is stored in an array that I want to show in html like this:
ID1/NewsTitle1/NewsDate1
ID2/NewsTitle2/NewsDate2
ID3/NewsTitle3/NewsDate3
ID4/NewsTitle4/NewsDate4
Yet it is showing like this:
ID1/NewsTitle1/NewsDate1
ID1/NewsTitle1/NewsDate1
ID1/NewsTitle1/NewsDate1
ID1/NewsTitle1/NewsDate1
Some extra info:
$this->_count_colls = 3;
$this->_count_keys = 4;
The PHP code:
public function __construct($sent_query_result)
{
$this->_sent_query_result = $sent_query_result;
$this->_count_colls = $this->_sent_query_result['count_colls'];
$this->_count_keys = count($this->_sent_query_result) - 1;
print_r($this->_count_keys);
for($i = 0; $i <= $this->_count_keys - 1; $i++) {
echo '<div class="tr">';
for($j = 0; $j <= $this->_count_colls - 1; $j++) {
echo '<div class="td">' . $this->_sent_query_result[0][$j] . '</div>';
}
echo '</div>';
}
}
The 0 in the following line has to be incremented by 3 it seems yet I can’t get this to work by replacing it with $j or $j++.
$this->_sent_query_result[0][$j]
Edit:
The array:
Array (
[0] => Array ( [0] => 1752 [1] => Test1 [2] => 2011-07-05 15:26:38 )
[1] => Array ( [0] => 1753 [1] => Test2 [2] => 2011-07-05 15:26:41 )
[2] => Array ( [0] => 1754 [1] => Test3 [2] => 2011-07-05 15:26:47 )
[3] => Array ( [0] => 1755 [1] => Test4 [2] => 2011-07-05 15:26:51 )
)
$jis the column key what you need is the result key$i.Try changing this:
to this: