I am trying to retrieve data from database using CodeIgniter. The query works fine and retrieves data into an array which can be shown with print_array().
Array
(
[0] => Array
(
[trans_id] => 33
[CustomerAccountNumber] => BR002
[TransactionType] => Invoice
[TransactionDate] => 2012-09-06 00:00:00
[InvoiceNo] => 00001732262
[OrderNo] => 0000183946
[GoodsValueInAccountCurrency] => 1055.26
[AccountBalance] => 1104.52
[SYSTraderTranTypeID] => 4
)
[1] => Array
(
[trans_id] => 34
[CustomerAccountNumber] => BR002
[TransactionType] => Invoice
[TransactionDate] => 2012-09-19 00:00:00
[InvoiceNo] => 00001375022
[OrderNo] => 0000184907
[GoodsValueInAccountCurrency] => 49.26
[AccountBalance] => 1104.52
[SYSTraderTranTypeID] => 4
)
)
But whenever I try to display data within a table to generate pdf,it gives me an error stating "Trying to get property of non-object". But all the object are coming into an array to display. Here is my code:
print_array($data['data']);
{ foreach ($data['data'] as $key=>$link)
{
{
$html .= '
<tr>
<td width = "100">'.$link->InvoiceNo.'</td>
<td width = "300">'.($link->OrderNo).'</td>
<td width = "100">'.($link->TransactionDate).'</td>
<td width = "100">'.($link->TransactionType).'</td>
<td width = "100">'.($link->GoodsValueInAccountCurrency).'</td>
</tr>';
}
}}
But this is giving me errors "Trying to get property of non-object". I am not getting any clue. Why? Please help.