• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database lib loading makes the page blank

#1
[eluser]Alhazred[/eluser]
Hi, I'm new to CodeIgniter and I'm following the documentation to learn.

I'm at the form validation section and I'm having a problem.
The documentation says to put these into the controller

Code:
$this->form_validation->set_rules('username', 'Username', 'required|min_length[5]|max_length[12]|is_unique[users.username]');
$this->form_validation->set_rules('password', 'Password', 'required|matches[passconf]');
$this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
$this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[users.email]');
I've put those lines and into the database I've created a table called "users" with the fields username, password and email, and I've inserted some records.

The problem is that if I load the db library the page with the form is blank, if I don't load the db library I get an error for $db class missing.
If I remove the is_unique() check and don't load the db lib, the form appears.

That should means that the db lib is loaded, but then something wrong happens.

I've tried both to load the db manually from the controller and automatically from the autoload.php

The connection data looks fine to me, this is what I have in the database.php
Code:
$active_group = 'default';
$active_record = FALSE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = 'root';
$db['default']['database'] = 'codeigniter';
$db['default']['dbdriver'] = 'mysqli';
$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;
What could I try to do to solve this problem?

#2
[eluser]Alhazred[/eluser]
I've tried the same code on a Windows system and it works, I've found a problem with the php.ini on my Linux system.

Solved.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.