Jump to content

Fatal error: Call to a member function where() on a non-object


Recommended Posts

I just got it! I noticed on config.php that enable query strings was set to false. I set it to true and it worked. loaded the wrong page and /validate_crendentials was in the url but that's a step.


In the meantime I was starting to transfer my files to the latest version. Do you think I'm ok working on 2.0.3 or should I continue to transfer it to 2.1.1?


thanks again for all of this help!

Link to post
Share on other sites

Do you think I'm ok working on 2.0.3 or should I continue to transfer it to 2.1.1?


I highly recommend you do so. Releases exist for a purpose (primarily to fix bugs and insecurities).


You'll be jumping two releases, so you need to follow both of these steps:




it's actually defaulting to the index page when I hit submit no matter if the fields are filled out or not. It seems like a step in the right direction though

Check your form_open to see where it points and then check that controller/method to see if is anything that would cause problems.

Link to post
Share on other sites

I have gone back to the most stripped down version of logging in an user. The form open location is "auth/validate_credentials" as that seems logical. Moreover when I take that out. After hitting submit on the login page it takes me to the index.php ( default view ) no matter what!


I also did the updates.


Here is what I currently have:





class User_model extends CI_Model {

function validate() 

	$this->db->where('email', $this->input->post('email'));
	$this->db->where('password', sha1($this->input->post('password')));
	$query = $this->db->get('users');

	if($query->num_rows == 1)
		return true;






<div class="structure clearfix">
<h1 class="title_header">
	Sign In
<div id="signin_form">
	echo validation_errors(); 
	echo form_open('auth/validate_credentials');
	echo "<div class='form_text_signin'>";
	echo "Email";
	echo "</div>";
	echo form_input('email');
	echo "<div class='form_text_signin'>";
	echo "Password";
	echo "</div>";
	echo form_input('password');
	echo form_submit('submit', 'Submit');
	echo form_close();






class Auth extends CI_Controller {

function __construct()


// Call the Model constructor




// this is automatically called if no other function is called

// it simply turns around and calls the login() function to show the login page


public function index() {





public function login() {

$data['main_content'] = 'auth/login';

$this->load->view('includes/templates/main_page_template', $data);



function validate_crendentials()


echo "<pre>";


echo "</pre>";






$data = array(

'email' => $this->input->post('email'),

'is_logged_in' => true
















Link to post
Share on other sites

Ok - this is getting a little despressing  :'( haha


I went ahead and just tried to transfer all of my files to version 2.1.2 and not worry about updating my current files twice because I was two version behind. I am STILL having data base issues from the get go.


A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: core/Loader.php

Line Number: 346


and here is that line in my files:




	if ($return === TRUE)
		return DB($params, $active_record);

	// Initialize the db variable.  Needed to prevent
	// reference errors with some configurations
	$CI->db = '';

	// Load the DB class
	$CI->db =& DB($params, $active_record);

Link to post
Share on other sites

right - that is my concern. it very well should be:



$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = 'root';
$db['default']['database'] = 'cysticlife_CI';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

Link to post
Share on other sites

What you posted is only half of the solution, of course - as you must ensure you have a database running that accepts those parameters.  This thread, however, has lost it's scope, and if you desire further general assistance, you can PM me and we can set up a training session for a reasonable cost.  Else, please hone in on a specific issue and the community may be able to aide you.

Link to post
Share on other sites


This topic is now archived and is closed to further replies.

  • 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.