Welcome Guest, Not a member yet? Register   Sign In
Strange Error Occurring While Using "$this"
#1

[eluser]Bl4cKWid0w[/eluser]
I'm trying to insert data into a database with an array, but I keep getting this error:
Quote:Fatal error: Using $this when not in object context in /home/unholy/public_html/mysite/system/application/controllers/clans.php on line 100

I can't figure out what's causing it. This is the code:
Code:
global $context;
          $today = date('o-m-d');
        $claninsert = array(
                        'clanName' => $_POST['clanName'],
                        'clanMotto' => $_POST['clanMotto'],
                        'clanLogo' => $_POST['clanLogo'],
                        'clanWebsite' => $_POST['clanWebsite'],
                        'clanEmail' => $_POST['clanEmail'],
                        'clanMSN' => $_POST['clanMSN'],
                        'clanAIM' => $_POST['clanAIM'],
                        'joinDate' => $today
                        );
                        
        $this->db->insert('clans', $claninsert); //Line 100
        $newclanId = mysql_insert_id();
        
        $memberinsert = array(
                              'memberID' => $context['user']['id'],
                              'clanID' => $newclanID,
                              'role' => "Leader",
                              'joinDate' => $today
                              );
                            
       $this->db->insert('clan_members', $memberinsert);

I indicated line 100 in a comment.
#2

[eluser]manilodisan[/eluser]
Is this inside a controller?
#3

[eluser]Bl4cKWid0w[/eluser]
Yes, and inside of a function.




Theme © iAndrew 2016 - Forum software by © MyBB