12-16-2015, 11:49 PM
(This post was last modified: 12-17-2015, 03:11 AM by wolfgang1983.)
I have created a set_language library where I can get the language code from my setting table and at the moment it is set as en.
So when I do this <?php echo $this->set_language->get_lang() ;?> it echos out en which is correct.
How ever when I try to get the directory value from my language table where code is en it does not return value. It should return directory name english.
What have I done wrong on my lang() function I have attached two images of database.
Any suggestions thanks in advance.
So when I do this <?php echo $this->set_language->get_lang() ;?> it echos out en which is correct.
How ever when I try to get the directory value from my language table where code is en it does not return value. It should return directory name english.
What have I done wrong on my lang() function I have attached two images of database.
PHP Code:
<?php
class Set_language {
public function __construct() {
$this->ci =& get_instance();
$this->ci->config->set_item('language', $this->lang());
}
public function lang() {
$this->ci->db->select('*');
$this->ci->db->from($this->ci->db->dbprefix . 'language');
$this->ci->db->where('code', $this->get_lang());
$query = $this->ci->db->get();
$row = $query->row();
return $row->directory;
}
public function get_lang() {
$this->ci->db->select('*');
$this->ci->db->from($this->ci->db->dbprefix . 'setting');
$this->ci->db->where('item_name', 'admin_language');
$query = $this->ci->db->get();
$row = $query->row();
return $row->item_value;
}
}
Quote:Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM `language`, `setting` WHERE `item_name` = 'admin_language'' at line 1
SELECT *, * FROM `language`, `setting` WHERE `item_name` = 'admin_language'
Filename: C:/wamp/www/project/admin/application/libraries/Set_language.php
Line Number: 24
Any suggestions thanks in advance.
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!