Severity: Notice Message: Trying to get property of non-object codeigniter [duplicate]












0
















This question already has an answer here:




  • Reference - What does this error mean in PHP?

    32 answers




My Controller:



function generateallmonthreport()
{
$month = $this->input->post('month');
$year = $this->input->post('year');
$familyid = $this->session->userdata('family_id');

$fulldata['dates'] = $this->Itemreport_model->getreportallmonth($month,$year);
$fulldata['members1'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['members2'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['members3'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['members4'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['members5'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['year'] = $year;
$fulldata['month'] = $month;

$this->load->view('header');
$this->load->view('itemreports/allmonthreportpage', $fulldata);
$this->load->view('footer');
}


My Model:



function getreportallmonth($month,$year)
{
$sql = "SELECT DISTINCT `item_date` FROM `items` WHERE MONTH(`item_date`)='$month' AND YEAR(`item_date`)='$year'";
$query = $this->db->query($sql);
return $query->result();
}

function getindependentmembers($familyid)
{
$sql = "SELECT * FROM `familymember` WHERE `family_id`='$familyid' AND `dependency`='1'";
$query = $this->db->query($sql);
return $query->result();
}

function getcountofexpensetype($memberid,$year,$month)
{
$sql = "SELECT COUNT(DISTINCT `item_expensetype`) AS spancount FROM `items` WHERE `item_purchaseby`='$memberid' AND MONTH(`item_date`)='$month' AND YEAR(`item_date`)='$year' AND `item_expensetype` IS NOT NULL";
$query = $this->db->query($sql);
return $query->result();
}

function getexpensetype($memberidforexpensetype,$year,$month)
{
$sql = "SELECT DISTINCT `item_expensetype` as expensetype FROM `items` WHERE `item_purchaseby`='$memberidforexpensetype' AND MONTH(`item_date`)='$month' AND YEAR(`item_date`)='$year' AND `item_expensetype` IS NOT NULL";
$query = $this->db->query($sql);
return $query->result();
}

function getallitems($thisdate)
{
$sql = "SELECT `item_name`,`item_price`,`item_purchasetype` FROM `items` WHERE `item_date`='$thisdate'";
$query = $this->db->query($sql);
return $query->result();
}

function getexpensetypefinal($memberidforexpensetypeprice,$year,$month)
{
$sql = "SELECT DISTINCT `item_expensetype` as expensetype FROM `items` WHERE `item_purchaseby`='$memberidforexpensetypeprice' AND MONTH(`item_date`)='$month' AND YEAR(`item_date`)='$year' AND `item_expensetype` IS NOT NULL";
$query = $this->db->query($sql);
return $query->result();
}


My View:



<table border="2" id="tab" style="width:100%" class="text-center m-auto table table-bordered table-hover">

<tr>
<td rowspan="2">Date</td>
<td rowspan="2">Items</td>

<!-- php code for getting all individual member header for individual expense types -->

<?php foreach ($members1 as $members1) { ?>
<?php
$this->load->model('Itemreport_model');
$memberid = $members1->member_id;
$countforcolspan = $this->Itemreport_model->getcountofexpensetype($memberid,$year,$month);
?>

<td colspan="<?php foreach ($countforcolspan as $countforcolspan) { echo $countforcolspan->spancount+1; } ?>">
<?php echo $members1->membername."'s Individual Expenses"; ?>
</td>

<?php } ?>

<td rowspan="2">Total Expense On Common</td>

<!-- php code for getting all individual member header -->
<?php foreach ($members2 as $members2) { ?>
<td rowspan="2"><?php echo $members2->membername."'s Total Expense (Individual + Common)"; ?></td>
<?php } ?>

<td rowspan="2">Total Expense Of Family</td>
</tr>

<tr>
<?php
foreach ($members3 as $members3) {
$memberidforexpensetype = $members3->member_id;
$expensetype = $this->Itemreport_model->getexpensetype($memberidforexpensetype,$year,$month);
foreach ($expensetype as $expensetype) { ?>
<td><?php echo $expensetype->expensetype; ?></td>
<?php } ?>
<td>Total</td>
<?php }
?>
</tr>

<tbody id="tbodydata">

<?php foreach ($dates as $dates) { ?>
<tr>

<td><?php $thisdate = $dates->item_date; echo $thisdate; ?></td>

<td><?php
$allitems = $this->Itemreport_model->getallitems($thisdate);
foreach ($allitems as $allitems) {
echo $allitems->item_name; ?> (<?php echo $allitems->item_price; ?>)
<?php }
?></td>

<?php foreach ($members4 as $members4) {
$memberidforexpensetypeprice = $members4->member_id;
$countforcolspan = $this->Itemreport_model->getexpensetypefinal($memberidforexpensetypeprice,$year,$month);
} ?>
</tr>
<?php } ?>

</tbody>


The code seems to work fine but gives me the notice of Trying to get property of non-object



Error:




A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: itemreports/allmonthreportpage.php Line Number: 68



Backtrace:
File: D:wampserverwwwhomeapplicationviewsitemreportsallmonthreportpage.php
Line: 68
Function: _error_handler



File: D:wampserverwwwhomeapplicationcontrollersItemreport.php
Line: 91
Function: view



File: D:wampserverwwwhomeindex.php
Line: 315
Function: require_once




I cannot spot the impropper part of code.. Please Help..!!










share|improve this question















marked as duplicate by RiggsFolly, Robbie Averill php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 19 '18 at 19:53


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • Can you identify allmonthreportpage.php and line 68 within that file please

    – RiggsFolly
    Nov 19 '18 at 19:14











  • Yes, its the view file

    – Ram
    Nov 19 '18 at 19:17











  • And line 68????

    – RiggsFolly
    Nov 19 '18 at 19:18











  • foreach ($allitems as $allitems) And BANG there goes the contents of $allitems from an array to something else

    – RiggsFolly
    Nov 19 '18 at 19:19











  • And then BANG Again foreach ($members4 as $members4)

    – RiggsFolly
    Nov 19 '18 at 19:19
















0
















This question already has an answer here:




  • Reference - What does this error mean in PHP?

    32 answers




My Controller:



function generateallmonthreport()
{
$month = $this->input->post('month');
$year = $this->input->post('year');
$familyid = $this->session->userdata('family_id');

$fulldata['dates'] = $this->Itemreport_model->getreportallmonth($month,$year);
$fulldata['members1'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['members2'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['members3'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['members4'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['members5'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['year'] = $year;
$fulldata['month'] = $month;

$this->load->view('header');
$this->load->view('itemreports/allmonthreportpage', $fulldata);
$this->load->view('footer');
}


My Model:



function getreportallmonth($month,$year)
{
$sql = "SELECT DISTINCT `item_date` FROM `items` WHERE MONTH(`item_date`)='$month' AND YEAR(`item_date`)='$year'";
$query = $this->db->query($sql);
return $query->result();
}

function getindependentmembers($familyid)
{
$sql = "SELECT * FROM `familymember` WHERE `family_id`='$familyid' AND `dependency`='1'";
$query = $this->db->query($sql);
return $query->result();
}

function getcountofexpensetype($memberid,$year,$month)
{
$sql = "SELECT COUNT(DISTINCT `item_expensetype`) AS spancount FROM `items` WHERE `item_purchaseby`='$memberid' AND MONTH(`item_date`)='$month' AND YEAR(`item_date`)='$year' AND `item_expensetype` IS NOT NULL";
$query = $this->db->query($sql);
return $query->result();
}

function getexpensetype($memberidforexpensetype,$year,$month)
{
$sql = "SELECT DISTINCT `item_expensetype` as expensetype FROM `items` WHERE `item_purchaseby`='$memberidforexpensetype' AND MONTH(`item_date`)='$month' AND YEAR(`item_date`)='$year' AND `item_expensetype` IS NOT NULL";
$query = $this->db->query($sql);
return $query->result();
}

function getallitems($thisdate)
{
$sql = "SELECT `item_name`,`item_price`,`item_purchasetype` FROM `items` WHERE `item_date`='$thisdate'";
$query = $this->db->query($sql);
return $query->result();
}

function getexpensetypefinal($memberidforexpensetypeprice,$year,$month)
{
$sql = "SELECT DISTINCT `item_expensetype` as expensetype FROM `items` WHERE `item_purchaseby`='$memberidforexpensetypeprice' AND MONTH(`item_date`)='$month' AND YEAR(`item_date`)='$year' AND `item_expensetype` IS NOT NULL";
$query = $this->db->query($sql);
return $query->result();
}


My View:



<table border="2" id="tab" style="width:100%" class="text-center m-auto table table-bordered table-hover">

<tr>
<td rowspan="2">Date</td>
<td rowspan="2">Items</td>

<!-- php code for getting all individual member header for individual expense types -->

<?php foreach ($members1 as $members1) { ?>
<?php
$this->load->model('Itemreport_model');
$memberid = $members1->member_id;
$countforcolspan = $this->Itemreport_model->getcountofexpensetype($memberid,$year,$month);
?>

<td colspan="<?php foreach ($countforcolspan as $countforcolspan) { echo $countforcolspan->spancount+1; } ?>">
<?php echo $members1->membername."'s Individual Expenses"; ?>
</td>

<?php } ?>

<td rowspan="2">Total Expense On Common</td>

<!-- php code for getting all individual member header -->
<?php foreach ($members2 as $members2) { ?>
<td rowspan="2"><?php echo $members2->membername."'s Total Expense (Individual + Common)"; ?></td>
<?php } ?>

<td rowspan="2">Total Expense Of Family</td>
</tr>

<tr>
<?php
foreach ($members3 as $members3) {
$memberidforexpensetype = $members3->member_id;
$expensetype = $this->Itemreport_model->getexpensetype($memberidforexpensetype,$year,$month);
foreach ($expensetype as $expensetype) { ?>
<td><?php echo $expensetype->expensetype; ?></td>
<?php } ?>
<td>Total</td>
<?php }
?>
</tr>

<tbody id="tbodydata">

<?php foreach ($dates as $dates) { ?>
<tr>

<td><?php $thisdate = $dates->item_date; echo $thisdate; ?></td>

<td><?php
$allitems = $this->Itemreport_model->getallitems($thisdate);
foreach ($allitems as $allitems) {
echo $allitems->item_name; ?> (<?php echo $allitems->item_price; ?>)
<?php }
?></td>

<?php foreach ($members4 as $members4) {
$memberidforexpensetypeprice = $members4->member_id;
$countforcolspan = $this->Itemreport_model->getexpensetypefinal($memberidforexpensetypeprice,$year,$month);
} ?>
</tr>
<?php } ?>

</tbody>


The code seems to work fine but gives me the notice of Trying to get property of non-object



Error:




A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: itemreports/allmonthreportpage.php Line Number: 68



Backtrace:
File: D:wampserverwwwhomeapplicationviewsitemreportsallmonthreportpage.php
Line: 68
Function: _error_handler



File: D:wampserverwwwhomeapplicationcontrollersItemreport.php
Line: 91
Function: view



File: D:wampserverwwwhomeindex.php
Line: 315
Function: require_once




I cannot spot the impropper part of code.. Please Help..!!










share|improve this question















marked as duplicate by RiggsFolly, Robbie Averill php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 19 '18 at 19:53


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • Can you identify allmonthreportpage.php and line 68 within that file please

    – RiggsFolly
    Nov 19 '18 at 19:14











  • Yes, its the view file

    – Ram
    Nov 19 '18 at 19:17











  • And line 68????

    – RiggsFolly
    Nov 19 '18 at 19:18











  • foreach ($allitems as $allitems) And BANG there goes the contents of $allitems from an array to something else

    – RiggsFolly
    Nov 19 '18 at 19:19











  • And then BANG Again foreach ($members4 as $members4)

    – RiggsFolly
    Nov 19 '18 at 19:19














0












0








0


0







This question already has an answer here:




  • Reference - What does this error mean in PHP?

    32 answers




My Controller:



function generateallmonthreport()
{
$month = $this->input->post('month');
$year = $this->input->post('year');
$familyid = $this->session->userdata('family_id');

$fulldata['dates'] = $this->Itemreport_model->getreportallmonth($month,$year);
$fulldata['members1'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['members2'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['members3'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['members4'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['members5'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['year'] = $year;
$fulldata['month'] = $month;

$this->load->view('header');
$this->load->view('itemreports/allmonthreportpage', $fulldata);
$this->load->view('footer');
}


My Model:



function getreportallmonth($month,$year)
{
$sql = "SELECT DISTINCT `item_date` FROM `items` WHERE MONTH(`item_date`)='$month' AND YEAR(`item_date`)='$year'";
$query = $this->db->query($sql);
return $query->result();
}

function getindependentmembers($familyid)
{
$sql = "SELECT * FROM `familymember` WHERE `family_id`='$familyid' AND `dependency`='1'";
$query = $this->db->query($sql);
return $query->result();
}

function getcountofexpensetype($memberid,$year,$month)
{
$sql = "SELECT COUNT(DISTINCT `item_expensetype`) AS spancount FROM `items` WHERE `item_purchaseby`='$memberid' AND MONTH(`item_date`)='$month' AND YEAR(`item_date`)='$year' AND `item_expensetype` IS NOT NULL";
$query = $this->db->query($sql);
return $query->result();
}

function getexpensetype($memberidforexpensetype,$year,$month)
{
$sql = "SELECT DISTINCT `item_expensetype` as expensetype FROM `items` WHERE `item_purchaseby`='$memberidforexpensetype' AND MONTH(`item_date`)='$month' AND YEAR(`item_date`)='$year' AND `item_expensetype` IS NOT NULL";
$query = $this->db->query($sql);
return $query->result();
}

function getallitems($thisdate)
{
$sql = "SELECT `item_name`,`item_price`,`item_purchasetype` FROM `items` WHERE `item_date`='$thisdate'";
$query = $this->db->query($sql);
return $query->result();
}

function getexpensetypefinal($memberidforexpensetypeprice,$year,$month)
{
$sql = "SELECT DISTINCT `item_expensetype` as expensetype FROM `items` WHERE `item_purchaseby`='$memberidforexpensetypeprice' AND MONTH(`item_date`)='$month' AND YEAR(`item_date`)='$year' AND `item_expensetype` IS NOT NULL";
$query = $this->db->query($sql);
return $query->result();
}


My View:



<table border="2" id="tab" style="width:100%" class="text-center m-auto table table-bordered table-hover">

<tr>
<td rowspan="2">Date</td>
<td rowspan="2">Items</td>

<!-- php code for getting all individual member header for individual expense types -->

<?php foreach ($members1 as $members1) { ?>
<?php
$this->load->model('Itemreport_model');
$memberid = $members1->member_id;
$countforcolspan = $this->Itemreport_model->getcountofexpensetype($memberid,$year,$month);
?>

<td colspan="<?php foreach ($countforcolspan as $countforcolspan) { echo $countforcolspan->spancount+1; } ?>">
<?php echo $members1->membername."'s Individual Expenses"; ?>
</td>

<?php } ?>

<td rowspan="2">Total Expense On Common</td>

<!-- php code for getting all individual member header -->
<?php foreach ($members2 as $members2) { ?>
<td rowspan="2"><?php echo $members2->membername."'s Total Expense (Individual + Common)"; ?></td>
<?php } ?>

<td rowspan="2">Total Expense Of Family</td>
</tr>

<tr>
<?php
foreach ($members3 as $members3) {
$memberidforexpensetype = $members3->member_id;
$expensetype = $this->Itemreport_model->getexpensetype($memberidforexpensetype,$year,$month);
foreach ($expensetype as $expensetype) { ?>
<td><?php echo $expensetype->expensetype; ?></td>
<?php } ?>
<td>Total</td>
<?php }
?>
</tr>

<tbody id="tbodydata">

<?php foreach ($dates as $dates) { ?>
<tr>

<td><?php $thisdate = $dates->item_date; echo $thisdate; ?></td>

<td><?php
$allitems = $this->Itemreport_model->getallitems($thisdate);
foreach ($allitems as $allitems) {
echo $allitems->item_name; ?> (<?php echo $allitems->item_price; ?>)
<?php }
?></td>

<?php foreach ($members4 as $members4) {
$memberidforexpensetypeprice = $members4->member_id;
$countforcolspan = $this->Itemreport_model->getexpensetypefinal($memberidforexpensetypeprice,$year,$month);
} ?>
</tr>
<?php } ?>

</tbody>


The code seems to work fine but gives me the notice of Trying to get property of non-object



Error:




A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: itemreports/allmonthreportpage.php Line Number: 68



Backtrace:
File: D:wampserverwwwhomeapplicationviewsitemreportsallmonthreportpage.php
Line: 68
Function: _error_handler



File: D:wampserverwwwhomeapplicationcontrollersItemreport.php
Line: 91
Function: view



File: D:wampserverwwwhomeindex.php
Line: 315
Function: require_once




I cannot spot the impropper part of code.. Please Help..!!










share|improve this question

















This question already has an answer here:




  • Reference - What does this error mean in PHP?

    32 answers




My Controller:



function generateallmonthreport()
{
$month = $this->input->post('month');
$year = $this->input->post('year');
$familyid = $this->session->userdata('family_id');

$fulldata['dates'] = $this->Itemreport_model->getreportallmonth($month,$year);
$fulldata['members1'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['members2'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['members3'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['members4'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['members5'] = $this->Itemreport_model->getindependentmembers($familyid);
$fulldata['year'] = $year;
$fulldata['month'] = $month;

$this->load->view('header');
$this->load->view('itemreports/allmonthreportpage', $fulldata);
$this->load->view('footer');
}


My Model:



function getreportallmonth($month,$year)
{
$sql = "SELECT DISTINCT `item_date` FROM `items` WHERE MONTH(`item_date`)='$month' AND YEAR(`item_date`)='$year'";
$query = $this->db->query($sql);
return $query->result();
}

function getindependentmembers($familyid)
{
$sql = "SELECT * FROM `familymember` WHERE `family_id`='$familyid' AND `dependency`='1'";
$query = $this->db->query($sql);
return $query->result();
}

function getcountofexpensetype($memberid,$year,$month)
{
$sql = "SELECT COUNT(DISTINCT `item_expensetype`) AS spancount FROM `items` WHERE `item_purchaseby`='$memberid' AND MONTH(`item_date`)='$month' AND YEAR(`item_date`)='$year' AND `item_expensetype` IS NOT NULL";
$query = $this->db->query($sql);
return $query->result();
}

function getexpensetype($memberidforexpensetype,$year,$month)
{
$sql = "SELECT DISTINCT `item_expensetype` as expensetype FROM `items` WHERE `item_purchaseby`='$memberidforexpensetype' AND MONTH(`item_date`)='$month' AND YEAR(`item_date`)='$year' AND `item_expensetype` IS NOT NULL";
$query = $this->db->query($sql);
return $query->result();
}

function getallitems($thisdate)
{
$sql = "SELECT `item_name`,`item_price`,`item_purchasetype` FROM `items` WHERE `item_date`='$thisdate'";
$query = $this->db->query($sql);
return $query->result();
}

function getexpensetypefinal($memberidforexpensetypeprice,$year,$month)
{
$sql = "SELECT DISTINCT `item_expensetype` as expensetype FROM `items` WHERE `item_purchaseby`='$memberidforexpensetypeprice' AND MONTH(`item_date`)='$month' AND YEAR(`item_date`)='$year' AND `item_expensetype` IS NOT NULL";
$query = $this->db->query($sql);
return $query->result();
}


My View:



<table border="2" id="tab" style="width:100%" class="text-center m-auto table table-bordered table-hover">

<tr>
<td rowspan="2">Date</td>
<td rowspan="2">Items</td>

<!-- php code for getting all individual member header for individual expense types -->

<?php foreach ($members1 as $members1) { ?>
<?php
$this->load->model('Itemreport_model');
$memberid = $members1->member_id;
$countforcolspan = $this->Itemreport_model->getcountofexpensetype($memberid,$year,$month);
?>

<td colspan="<?php foreach ($countforcolspan as $countforcolspan) { echo $countforcolspan->spancount+1; } ?>">
<?php echo $members1->membername."'s Individual Expenses"; ?>
</td>

<?php } ?>

<td rowspan="2">Total Expense On Common</td>

<!-- php code for getting all individual member header -->
<?php foreach ($members2 as $members2) { ?>
<td rowspan="2"><?php echo $members2->membername."'s Total Expense (Individual + Common)"; ?></td>
<?php } ?>

<td rowspan="2">Total Expense Of Family</td>
</tr>

<tr>
<?php
foreach ($members3 as $members3) {
$memberidforexpensetype = $members3->member_id;
$expensetype = $this->Itemreport_model->getexpensetype($memberidforexpensetype,$year,$month);
foreach ($expensetype as $expensetype) { ?>
<td><?php echo $expensetype->expensetype; ?></td>
<?php } ?>
<td>Total</td>
<?php }
?>
</tr>

<tbody id="tbodydata">

<?php foreach ($dates as $dates) { ?>
<tr>

<td><?php $thisdate = $dates->item_date; echo $thisdate; ?></td>

<td><?php
$allitems = $this->Itemreport_model->getallitems($thisdate);
foreach ($allitems as $allitems) {
echo $allitems->item_name; ?> (<?php echo $allitems->item_price; ?>)
<?php }
?></td>

<?php foreach ($members4 as $members4) {
$memberidforexpensetypeprice = $members4->member_id;
$countforcolspan = $this->Itemreport_model->getexpensetypefinal($memberidforexpensetypeprice,$year,$month);
} ?>
</tr>
<?php } ?>

</tbody>


The code seems to work fine but gives me the notice of Trying to get property of non-object



Error:




A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: itemreports/allmonthreportpage.php Line Number: 68



Backtrace:
File: D:wampserverwwwhomeapplicationviewsitemreportsallmonthreportpage.php
Line: 68
Function: _error_handler



File: D:wampserverwwwhomeapplicationcontrollersItemreport.php
Line: 91
Function: view



File: D:wampserverwwwhomeindex.php
Line: 315
Function: require_once




I cannot spot the impropper part of code.. Please Help..!!





This question already has an answer here:




  • Reference - What does this error mean in PHP?

    32 answers








php mysql codeigniter codeigniter-3






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 '18 at 19:13









RiggsFolly

70.4k1864111




70.4k1864111










asked Nov 19 '18 at 19:09









RamRam

45




45




marked as duplicate by RiggsFolly, Robbie Averill php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 19 '18 at 19:53


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by RiggsFolly, Robbie Averill php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 19 '18 at 19:53


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • Can you identify allmonthreportpage.php and line 68 within that file please

    – RiggsFolly
    Nov 19 '18 at 19:14











  • Yes, its the view file

    – Ram
    Nov 19 '18 at 19:17











  • And line 68????

    – RiggsFolly
    Nov 19 '18 at 19:18











  • foreach ($allitems as $allitems) And BANG there goes the contents of $allitems from an array to something else

    – RiggsFolly
    Nov 19 '18 at 19:19











  • And then BANG Again foreach ($members4 as $members4)

    – RiggsFolly
    Nov 19 '18 at 19:19



















  • Can you identify allmonthreportpage.php and line 68 within that file please

    – RiggsFolly
    Nov 19 '18 at 19:14











  • Yes, its the view file

    – Ram
    Nov 19 '18 at 19:17











  • And line 68????

    – RiggsFolly
    Nov 19 '18 at 19:18











  • foreach ($allitems as $allitems) And BANG there goes the contents of $allitems from an array to something else

    – RiggsFolly
    Nov 19 '18 at 19:19











  • And then BANG Again foreach ($members4 as $members4)

    – RiggsFolly
    Nov 19 '18 at 19:19

















Can you identify allmonthreportpage.php and line 68 within that file please

– RiggsFolly
Nov 19 '18 at 19:14





Can you identify allmonthreportpage.php and line 68 within that file please

– RiggsFolly
Nov 19 '18 at 19:14













Yes, its the view file

– Ram
Nov 19 '18 at 19:17





Yes, its the view file

– Ram
Nov 19 '18 at 19:17













And line 68????

– RiggsFolly
Nov 19 '18 at 19:18





And line 68????

– RiggsFolly
Nov 19 '18 at 19:18













foreach ($allitems as $allitems) And BANG there goes the contents of $allitems from an array to something else

– RiggsFolly
Nov 19 '18 at 19:19





foreach ($allitems as $allitems) And BANG there goes the contents of $allitems from an array to something else

– RiggsFolly
Nov 19 '18 at 19:19













And then BANG Again foreach ($members4 as $members4)

– RiggsFolly
Nov 19 '18 at 19:19





And then BANG Again foreach ($members4 as $members4)

– RiggsFolly
Nov 19 '18 at 19:19












1 Answer
1






active

oldest

votes


















0














As indicated in the comments, you cannot use the variable that holds the array to also hold the values, like in foreach ($members4 as $members4). It overwrites the value held in $members4, which makes the loop do things you don't expect.



To solve it, just use a different variable, like for example $member like here:



 <?php foreach ($members4 as $member) {
$memberidforexpensetypeprice = $member->member_id;
$countforcolspan = $this->Itemreport_model->getexpensetypefinal($memberidforexpensetypeprice,$year,$month);
} ?>





share|improve this answer


























  • Except as the other foreach's seem not to have caused an error. I would guess that $member is not actually an Object, just to make matters more confusing

    – RiggsFolly
    Nov 19 '18 at 19:34













  • Edited as per your explanation. Working fine. Thank you very much... I wasted nearly a day finding the solution. Appreciate your help.

    – Ram
    Nov 19 '18 at 19:37


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














As indicated in the comments, you cannot use the variable that holds the array to also hold the values, like in foreach ($members4 as $members4). It overwrites the value held in $members4, which makes the loop do things you don't expect.



To solve it, just use a different variable, like for example $member like here:



 <?php foreach ($members4 as $member) {
$memberidforexpensetypeprice = $member->member_id;
$countforcolspan = $this->Itemreport_model->getexpensetypefinal($memberidforexpensetypeprice,$year,$month);
} ?>





share|improve this answer


























  • Except as the other foreach's seem not to have caused an error. I would guess that $member is not actually an Object, just to make matters more confusing

    – RiggsFolly
    Nov 19 '18 at 19:34













  • Edited as per your explanation. Working fine. Thank you very much... I wasted nearly a day finding the solution. Appreciate your help.

    – Ram
    Nov 19 '18 at 19:37
















0














As indicated in the comments, you cannot use the variable that holds the array to also hold the values, like in foreach ($members4 as $members4). It overwrites the value held in $members4, which makes the loop do things you don't expect.



To solve it, just use a different variable, like for example $member like here:



 <?php foreach ($members4 as $member) {
$memberidforexpensetypeprice = $member->member_id;
$countforcolspan = $this->Itemreport_model->getexpensetypefinal($memberidforexpensetypeprice,$year,$month);
} ?>





share|improve this answer


























  • Except as the other foreach's seem not to have caused an error. I would guess that $member is not actually an Object, just to make matters more confusing

    – RiggsFolly
    Nov 19 '18 at 19:34













  • Edited as per your explanation. Working fine. Thank you very much... I wasted nearly a day finding the solution. Appreciate your help.

    – Ram
    Nov 19 '18 at 19:37














0












0








0







As indicated in the comments, you cannot use the variable that holds the array to also hold the values, like in foreach ($members4 as $members4). It overwrites the value held in $members4, which makes the loop do things you don't expect.



To solve it, just use a different variable, like for example $member like here:



 <?php foreach ($members4 as $member) {
$memberidforexpensetypeprice = $member->member_id;
$countforcolspan = $this->Itemreport_model->getexpensetypefinal($memberidforexpensetypeprice,$year,$month);
} ?>





share|improve this answer















As indicated in the comments, you cannot use the variable that holds the array to also hold the values, like in foreach ($members4 as $members4). It overwrites the value held in $members4, which makes the loop do things you don't expect.



To solve it, just use a different variable, like for example $member like here:



 <?php foreach ($members4 as $member) {
$memberidforexpensetypeprice = $member->member_id;
$countforcolspan = $this->Itemreport_model->getexpensetypefinal($memberidforexpensetypeprice,$year,$month);
} ?>






share|improve this answer














share|improve this answer



share|improve this answer








answered Nov 19 '18 at 19:33


























community wiki





Joni














  • Except as the other foreach's seem not to have caused an error. I would guess that $member is not actually an Object, just to make matters more confusing

    – RiggsFolly
    Nov 19 '18 at 19:34













  • Edited as per your explanation. Working fine. Thank you very much... I wasted nearly a day finding the solution. Appreciate your help.

    – Ram
    Nov 19 '18 at 19:37



















  • Except as the other foreach's seem not to have caused an error. I would guess that $member is not actually an Object, just to make matters more confusing

    – RiggsFolly
    Nov 19 '18 at 19:34













  • Edited as per your explanation. Working fine. Thank you very much... I wasted nearly a day finding the solution. Appreciate your help.

    – Ram
    Nov 19 '18 at 19:37

















Except as the other foreach's seem not to have caused an error. I would guess that $member is not actually an Object, just to make matters more confusing

– RiggsFolly
Nov 19 '18 at 19:34







Except as the other foreach's seem not to have caused an error. I would guess that $member is not actually an Object, just to make matters more confusing

– RiggsFolly
Nov 19 '18 at 19:34















Edited as per your explanation. Working fine. Thank you very much... I wasted nearly a day finding the solution. Appreciate your help.

– Ram
Nov 19 '18 at 19:37





Edited as per your explanation. Working fine. Thank you very much... I wasted nearly a day finding the solution. Appreciate your help.

– Ram
Nov 19 '18 at 19:37



Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents