Welcome Guest, Not a member yet? Register   Sign In
Couldn't connect to database
#1

[eluser]Unknown[/eluser]
Hi,

I use Codeigniter together with EasyPHP (both the newest). Creating pages was working well but when I started to use database I got a serious problem: When i open the page in my web browser the page loads something but does nothing. No error caption or text, just still loading. Some hints?

Here is the code

autoload.php:
Code:
$autoload['libraries'] = array('database', 'session', 'validation');

database.php:
Code:
$active_group = "default";
$active_record = TRUE;

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "";
$db['default']['database'] = "school";
$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";

welcome.php:
Code:
$this->db->select('name, lastname');
$this->db->from('student');
$this->db->where('username', 'myuser');
$query = $this->db->get();
if ($query->num_rows() > 0)
{
$row = $query->row();

echo $row->name;
echo $row->lastname;
}

Thanks, Lukas
#2

[eluser]mi6crazyheart[/eluser]
Where is u'r VIEW file? Include a VIEW file & test once again...
#3

[eluser]Unknown[/eluser]
Ha, problem solved (overcommed). The new EasyPHP is stupid, it doesn't work with codeigniter. I installed XAMPP and it works. It was not problem of my code. But THX
#4

[eluser]mi6crazyheart[/eluser]
Great. Glad to knew it... :coolsmile:




Theme © iAndrew 2016 - Forum software by © MyBB