CodeIgniter Forums
Strange problem and blank page - 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: Strange problem and blank page (/showthread.php?tid=7166)



Strange problem and blank page - El Forum - 03-27-2008

[eluser]aypnos[/eluser]
Hello, this is my first post. I'm working with CI framework just a few days, it's great and nice documented. But I have a strange problem. Here is the "bad" code, take a look:

Code:
function people_insert()
    {
        if($this->uri->segment(3) == 0)
        {
            $this->db->insert('people',$_POST);
            redirect('welcome');
        }
        else
        {
            $id = $this->uri->segment(3);
            $dbdata = array(
                'first' => $_POST["first"];
                'last' => $_POST["last"];
            )
            $this->db->update('people', $dbdata, "id = ".$id);
        }
    }

It's a function in welcome controller. When I reload my page with this code I take a blank page! When I comment the lines

Code:
$dbdata = array(
    'first' => $_POST["first"];
    'last'  => $_POST["last"];
)

in else statement it work. Whats wrong with my array?!
Maybe I cannot see it becauce I have 2 hours now on this.


Thanks in advance!

PS. I get no error even in the log.


Strange problem and blank page - El Forum - 03-27-2008

[eluser]dark_lord[/eluser]
Code:
function people_insert()
    {
        if($this->uri->segment(3) == 0)
        {
            $this->db->insert('people',$_POST);
            redirect('welcome');
        }
        else
        {
            $id = $this->uri->segment(3);
            $dbdata = array(
                'first' => $_POST["first"];
                'last' => $_POST["last"];
            )
            $this->db->update('people', $dbdata, "id = ".$id);
        }
    }

Try this...

Code:
function people_insert()
    {
        if($this->uri->segment(3) == 0)
        {
            $dbdata = array(
                'first' => $_POST["first"],
                'last' => $_POST["last"]
            );

            $this->db->insert('people',$dbdata);
            redirect('welcome/successfull_insert_page');
        }
        else
        {
            $id = $this->uri->segment(3);
            $dbdata = array(
                'first' => $_POST["first"],
                'last' => $_POST["last"]
            );
            $this->db->update('people', $dbdata, "id = ".$id);
            redirect('welcome/successfull_update_page');
        }
    }



Strange problem and blank page - El Forum - 03-28-2008

[eluser]GSV Sleeper Service[/eluser]
your $dbdata array is wrong, it should be

Code:
$dbdata = array(
                'first' => $_POST["first"],
                'last' => $_POST["last"]
            );



Strange problem and blank page - El Forum - 03-28-2008

[eluser]dark_lord[/eluser]
Oh, yep! Didnt't see it a while ago. Thank for the correction dude. :-)


Strange problem and blank page - El Forum - 03-28-2008

[eluser]aypnos[/eluser]
Thank you for your replies, it was a stupid syntax...
I was dizzy!


Goodmorning.