CodeIgniter Forums
database problem. Help me! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: database problem. Help me! (/thread-1720.html)



database problem. Help me! - El Forum - 06-22-2007

[eluser]java[/eluser]
I want to get value of 1 table via id of 2 table. I have tried to use join() query command to solve but it not effective and display this error:
Quote:An Error Was Encountered
Unable to load the requested language file: language/db_lang.php
This is my code:
Code:
$this->db->select('SoBaoDanh,HoTen,NgaySinh,DiaChi,ChieuCao,CanNang,VongNguc,VongEo,VongMong');
        //$this->db->select('Ten');// field name of another table
        $this->db->from('hoahau');
        $this->db->join('thanhpho','ThanhPhoID = ThanhPhoID');// join 2 table
        $this->db->where('Enable','1');
        $this->db->orderby('HoahauID desc');
How can i get the value of a table which have related with another table? Tell me please..


database problem. Help me! - El Forum - 06-22-2007

[eluser]giaodn[/eluser]
[quote author="java" date="1182521482"]I want to get value of 1 table via id of 2 table. I have tried to use join() query command to solve but it not effective and display this error:
Quote:An Error Was Encountered
Unable to load the requested language file: language/db_lang.php
This is my code:
Code:
$this->db->select('SoBaoDanh,HoTen,NgaySinh,DiaChi,ChieuCao,CanNang,VongNguc,VongEo,VongMong');
        //$this->db->select('Ten');// field name of another table
        $this->db->from('hoahau');
        $this->db->join('thanhpho','ThanhPhoID = ThanhPhoID');// join 2 table
        $this->db->where('Enable','1');
        $this->db->orderby('HoahauID desc');
How can i get the value of a table which have related with another table? Tell me please..[/quote]
a.c a.c, if you still want the CI community support you solve this problem, please post your DB schema of two these tables


database problem. Help me! - El Forum - 06-22-2007

[eluser]java[/eluser]
Ok! This is full code of table "thanhpho" :
Code:
function getCity()
    {
    
        $this->db->select('Ten');
        $this->db->select('ThanhPhoID');
        $this->db->from('thanhpho');
        $this->db->where('Enable', '1');
        $this->db->orderby('Priority');
        // load it
        return $this->db->get();
    }
and of table "hoahau" :
Code:
function getJoiner($Type)
    {
        //load
         $this->db->select('SoBaoDanh,HoTen,NgaySinh,DiaChi,ChieuCao,CanNang,VongNguc,VongEo,VongMong');
        //$this->db->select('Ten');// name of city
        $this->db->from('hoahau');
        //$this->db->join('thanhpho','ThanhPhoID = ThanhPhoID');// join 2 table
        $this->db->where('Enable','1');
        $this->db->orderby('HoahauID desc');
                
    return $this->db->get();
    }
i want to join 2 table via common field "ThanhPhoID" and want to get value of field "Ten" of table "thanhpho" to load into my page


database problem. Help me! - El Forum - 06-22-2007

[eluser]giaodn[/eluser]
[quote author="java" date="1182522923"]Ok! This is full code of table "thanhpho" :
Code:
function getCity()
    {
    
        $this->db->select('Ten');
        $this->db->select('ThanhPhoID');
        $this->db->from('thanhpho');
        $this->db->where('Enable', '1');
        $this->db->orderby('Priority');
        // load it
        return $this->db->get();
    }
and of table "hoahau" :
Code:
function getJoiner($Type)
    {
        //load
         $this->db->select('SoBaoDanh,HoTen,NgaySinh,DiaChi,ChieuCao,CanNang,VongNguc,VongEo,VongMong');
        //$this->db->select('Ten');// name of city
        $this->db->from('hoahau');
        //$this->db->join('thanhpho','ThanhPhoID = ThanhPhoID');// join 2 table
        $this->db->where('Enable','1');
        $this->db->orderby('HoahauID desc');
                
    return $this->db->get();
    }
i want to join 2 table via common field "ThanhPhoID" and want to get value of field "Ten" of table "thanhpho" to load into my page[/quote]
We don't need the source code, we need the DB schema or some thing that help us understand the relationship of a bow tables


database problem. Help me! - El Forum - 04-22-2008

[eluser]msk_mx[/eluser]
The problem is that file "db_lang.php" does not exist in folder "language/your language"

Example

System -
----|-language
-----------|-spanish
---------------|-language
-------------------|-db_lang.php

This file is for view errors of the querys of database