Welcome Guest, Not a member yet? Register   Sign In
RE:[help!!!] A PHP Error was encountered
#1

[eluser]maria clara[/eluser]
hi to all,

my console keeps on showing this message:
Code:
<p>Severity: Warning</p>
<p>Message:  Invalid argument supplied for foreach()</p>
<p>Filename: models/ccm_receipt_db.php</p>
<p>Line Number: 309</p>

<p>Severity: Warning</p>
<p>Message:  Invalid argument supplied for foreach()</p>
<p>Filename: models/ccm_receipt_db.php</p>
<p>Line Number: 332</p>

here's my MODEL:
Code:
function save_detail($id,$rows0,$rows1,$rows2,$rows3,$dt)
    {
        $this->db->where('receipt_id', $id);
        $this->db->delete('ccm_receipt_t');        
        
    
        foreach ($rows0 as $row0)
        {
            $rdata = explode('|', $row0);
            
            $data['receipt_id'] = $id;
            $data['si_id'] = $rdata[7];
            $data['inv_date'] = convertViewDate($rdata[2]);
            $data['inv_balance'] = $rdata[3];
            $data['applied'] = $rdata[4];
            $data['ewt'] = $rdata[5];
            $data['evat'] = $rdata[6];
            
            $this->db->insert('ccm_receipt_t', $data);
            
            $this->updateSalesBalance($data);    
        
        }


anyone has an idea???

thanks in advance,
maria
#2

[eluser]WebsiteDuck[/eluser]
In your foreach, $rows0 doesn't exist as an array, make sure you are passing it in correctly
#3

[eluser]maria clara[/eluser]
[quote author="WebsiteDuck" date="1263290139"]In your foreach, $rows0 doesn't exist as an array, make sure you are passing it in correctly[/quote]

i have used print_r();
Code:
print_r($rows0);
        foreach ($rows0 as $row0)

and still it shows me the error.
#4

[eluser]WebsiteDuck[/eluser]
What did you get when you used print_r($rows0) ?
#5

[eluser]maria clara[/eluser]
it still hows me the error with invalid argument supplied for foreach():

and it pertains to this script:
foreach ($rows0 as $row0)
#6

[eluser]saidai jagan[/eluser]
show this
Code:
echo '<pre>';
print_r($rows0);
echo '</pre>';
die();
#7

[eluser]maria clara[/eluser]
[quote author="saidai jagan" date="1263292088"]show this
Code:
echo '<pre>';
print_r($rows0);
echo '</pre>';
die();
[/quote]

when i tried your script it shows this in my console:
Code:
<pre></pre>

it doesn't show anything but just that preformatted tag
#8

[eluser]saidai jagan[/eluser]
use it in u r model
Code:
function save_detail($id,$rows0=array(),$rows1,$rows2,$rows3,$dt)
#9

[eluser]Ben Edmunds[/eluser]
OK, so where are you passing in $row0 from?

Post that code please.
#10

[eluser]maria clara[/eluser]
[quote author="saidai jagan" date="1263293941"]use it in u r model
Code:
function save_detail($id,$rows0=array(),$rows1,$rows2,$rows3,$dt)
[/quote]

i tried your script but it shows
Code:
Message:  Invalid argument supplied for foreach()</p>




Theme © iAndrew 2016 - Forum software by © MyBB