Adem Natural Adem Natural - 1 year ago 106
SQL Question

Call to undefined function result() in Codeigniter

please help me, i've problem for get a value of database
in one page i called result() like code below :

<li><a href="#"><i class="fa fa-twitter"></i> Your Bird </a>
<?php foreach ($burung->result() as $burung) {
echo "<li><a href=\"panels.html\">$burung->burung</a></li>";

and next code :

<div class="row">
<?php foreach ($burung.result() as $burung) {
echo "
<div class=\"col-md-3\">
<div class=\"panel panel-default\">
<div class=\"panel-body bk-primary text-light\">
<div class=\"stat-panel text-center\">
<div class=\"stat-panel-number h1 \">24</div>
<div class=\"stat-panel-title text-uppercase\">$burung->burung</div>
<a href=\"#\" class=\"block-anchor panel-footer\">Full Detail <i class=\"fa fa-arrow-right\"></i></a>

but the when i run this page doesn't work with message :
Call to undefined function result()

Answer Source

Change this

<?php foreach ($burung.result() as $burung) {

to this

<?php foreach ($burung->result_array() as $row) {

and inside code $row['burung']

Use/Change result_array() instead of result(). Read this Result Arrays in

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download