CodeIgniter Forums
A PHP Error was encountered : Invalid argument supplied for foreach() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: A PHP Error was encountered : Invalid argument supplied for foreach() (/showthread.php?tid=29775)



A PHP Error was encountered : Invalid argument supplied for foreach() - El Forum - 04-20-2010

[eluser]vvva_avvv[/eluser]
Can you help me?.. I try to use query standard multiple result(object) in my update function. I can get data from my database initialy with this foreach() but when I update my data, it can't work then It will appear error message like this:

A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: guest/superieur_guest.php
Line Number: 31

I'm confused. There isn't trouble when I update.I mean my database updated successful. But why foreach() can read my database after that.Please help me :cheese:


A PHP Error was encountered : Invalid argument supplied for foreach() - El Forum - 04-21-2010

[eluser]WanWizard[/eluser]
Can you show us the code? Guessing isn't my strongest point...


A PHP Error was encountered : Invalid argument supplied for foreach() - El Forum - 04-23-2010

[eluser]vvva_avvv[/eluser]
Thank you.. it have solved Smile Can you help me again? I try to upload image in some folder. I have created folder uploads in root.
function do_upload()
{
$config['upload_path'] = '../uploads/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '200';
$config['max_width'] = '300';
$config['max_height'] = '300';

$this->load->library('upload', $config);

if ( ! $this->upload->do_upload('file'))
{
$error = array('error' => $this->upload->display_errors());

$this->load->view('signup', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$data['main'] = 'signup_successful';
$this->load->view('superieur',$data);

}
}

It execute signup_successful but I can't find the image in my folder. It still empty. Please help me..why it can't work... thanks for your help Wink


A PHP Error was encountered : Invalid argument supplied for foreach() - El Forum - 06-14-2010

[eluser]daelsepara[/eluser]
perhaps, the permissions of the ../uploads directory is at fault?. it must be 777.