Welcome Guest, Not a member yet? Register   Sign In
Passing a view as a variable.
#31

[eluser]ellipsis[/eluser]
I meant call the function from one controller into another controller.

As for the query, yeah.. that was the problem, thanks Smile.

I actually use notepad++ because I got used to it for coding in web-related languages... I like it better than e - text editor when it comes to multiple file management. I've used eclipse for java and have it so I guess I could give it a go.
#32

[eluser]Dam1an[/eluser]
I've never had to call a function from one controller in another, so can't really help much there, although there are plenty (well, several) threads about it in the forums, so a quick search should give you something.
Depending on what function you're calling, would it not maybe be better to move said functionality into a library?

And if you go for Eclipse, you'll need the PDT plugin (you can get either the plugin on it's own, or an all in one). But my advice is to avoid the new Galileo release of Eclipse... It's s...l...o...w... (I'm going to reinstall ganymade)
#33

[eluser]ellipsis[/eluser]
Yeah, I don't like galileo either.

I am passing something through $logindata (it contains, among other things, the username). What I'm trying to do is get the id corresponding to the username. Now, with the current code

Code:
function get_id($logindata)
    {
        $this->db->select('id')->from('users')->where('username', $logindata['username']);    
        $id=$this->db->get();
        return $id;
    }

I get quite a few errors and all of them are coming from the sessions library.

Quote:A PHP Error was encountered

Severity: 4096

Message: Object of class CI_DB_mysql_result could not be converted to string

Filename: libraries/Session.php

Line Number: 683


A PHP Error was encountered

Severity: Notice

Message: Object of class CI_DB_mysql_result to string conversion

Filename: libraries/Session.php

Line Number: 683


A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\site\system\libraries\Exceptions.php:164)

Filename: libraries/Session.php

Line Number: 662

Edit

Problem fixed for now...

Code:
function get_id($logindata)
    {

        $this->db->select('id')->from('users')->where('username', $logindata['username']);    
        $query=$this->db->get();
        foreach($query->result() as $row)
        {
            $id=$row->id;
        }
        return $id;
    }




Theme © iAndrew 2016 - Forum software by © MyBB