Jump to content

CODE IGNITOR IS GOING TO GIVE ME A STROKE


Spring

Recommended Posts

THESE ARE BEING LOADED GOD DAMMIT

$autoload['libraries'] = array('database', 'image_lib');

 

I seriously can't do this without loading the database directly! I get: Call to a member function get() on a non-object WHEN I DONT LOAD THE DB DIRECTLY

 

class Port_model extends CI_Controller {

function __construct() {
	parent::__construct();
}

function getData()
{
	$query = $this->db->get('port');

	if ($query->num_rows() > 0) {
		//Lets get our data from announcements and pass it to an array
		foreach ($query->result() as $row) {
			$data[] = $row;
		}
	} return $data;
}

}

 

and i think its the damn .htaccess!!!

ALSO, I CANT LOAD THE IMAGE LIB LIBRARY WITHOUT GETTING A SIMILAR FUCKING PROBLEM. IS THIS THANKS TO .HTACESS!?

 

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /ci/

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /ci/index.php?/$1 [L]
    
    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /ci/index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /ci/index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>  

 

Link to comment
Share on other sites

Where exactly is $this->db defined? Iv'e not used CodeIgnitor because I believe it is poorly designed, I don't however think it is that poorly designed that it would setup a database connection within a Controller.

 

Database interaction belongs in your Models, not your Controllers.

 

ps: .htaccess has NOTHING AT ALL to do with your issue.

Link to comment
Share on other sites

Where exactly is $this->db defined? Iv'e not used CodeIgnitor because I believe it is poorly designed, I don't however think it is that poorly designed that it would setup a database connection within a Controller.

 

Database interaction belongs in your Models, not your Controllers.

 

ps: .htaccess has NOTHING AT ALL to do with your issue.

 

$this->db is defined in the autoload, which is the first line of code at the top. I have no database interaction in my controller, that is the model I'm using. I should not have to define the DB class if I use the auto load. It's ridiculous. I have an almost 100% similar file, and it's works just fine. I honestly don't have the patience to be stuck on errors like this...

 

Also, I think I just found the error now..I need to stop programming late night. I'm going to have a heart attack.

Link to comment
Share on other sites

I have no database interaction in my controller, that is the model I'm using.

 

Then why does it extend the CI_Controller ?

 

That's the fix that I made, but while I have you I do have another problem..

This code is almost directly from the user_guide find on the website, but my CI doesn't recognize the library..Am I better off asking on the CI forums? Or do you think you can give it a go? The error is the same as above.

$config['image_library'] = 'gd2';
	$config['source_image'] = '/ci/images/port/threechan.png';
	$config['create_thumb'] = TRUE;
	$config['maintain_ratio'] = TRUE;
	$config['width'] = 75;
	$config['height'] = 50;

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

	 echo $this->image_lib->resize();

 

Jesus never, I'm just not going to program late night, thank you.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.