Welcome Guest, Not a member yet? Register   Sign In
Problem with SQL JOIN and CI query results
#1

[eluser]dandys997[/eluser]
Hi!
I've got a three tables in MySQL database, for example:
- movie,
- user,
- category.
I need to join them, so I use a model's method with this code

Code:
$this->db->order_by("date");
$this->db->join("category", "category.id_category=movie.id_movie");
$this->db->join("user", "user.id_user=movie.id_movie");
$query=$this->db->get("movie", 10);

As a result I get an object: $query. Now I can easily access the query's data, for example:

Code:
$row=$query->row();
$row->field_name;

But there's a one problem: tables "category" and "user" have one the same named field: "name". How could I access field from above query with selecting source table? This code:
Code:
$row->category.name

doesn't work.

Thanks in advance for help!


Messages In This Thread
Problem with SQL JOIN and CI query results - by El Forum - 02-28-2011, 10:48 AM
Problem with SQL JOIN and CI query results - by El Forum - 02-28-2011, 12:13 PM
Problem with SQL JOIN and CI query results - by El Forum - 02-28-2011, 12:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB