Welcome Guest, Not a member yet? Register   Sign In
Problem with join !
#12

[eluser]jmadsen[/eluser]
@NETACCESS - Your code looks correct to me. Put
Code:
$this->db->last_query();
after
Code:
$query = $this->db->get('projetsPortfolio');
- it will print out your query. Then run that inside phpmyadmin or whatever you use and confirm that the query is or is not producing the correct result set.

just from eye-balling, your code looks right, so I think there might be an issue somewhere else (in your controller or view). If it still doesn't work, please post the actual query here.

@osci - a left join will simply return images that don't have projects (orphan image rows) Nothing to do with 1-to-many queries

@brucebat - these days Views are used mainly to help simplify very complex queries, and speed them up by allowing the query to be "pre-cached". When your professor talked about security, he meant a couple of things - 1) reducing direct access to tables (granting select rights only on the views); 2) "hiding" the names of the tables and fields to make injection-style attacks more difficult (a cracker only knows the names of the views, not the real, underlying names)

While these are both good ideas, they are a bit antiquated and you will rarely find views used for security in your daily work. You will find them for complex queries, but a single join such as what NETACCESS wants to do wouldn't get any benefit.

In any case, the view needs to be built from the correct query in the first place :-)


Messages In This Thread
Problem with join ! - by El Forum - 06-17-2011, 04:19 AM
Problem with join ! - by El Forum - 06-17-2011, 04:28 AM
Problem with join ! - by El Forum - 06-17-2011, 04:28 AM
Problem with join ! - by El Forum - 06-17-2011, 04:29 AM
Problem with join ! - by El Forum - 06-17-2011, 04:38 AM
Problem with join ! - by El Forum - 06-17-2011, 06:54 AM
Problem with join ! - by El Forum - 06-17-2011, 08:31 AM
Problem with join ! - by El Forum - 06-17-2011, 01:20 PM
Problem with join ! - by El Forum - 06-17-2011, 03:45 PM
Problem with join ! - by El Forum - 06-17-2011, 03:57 PM
Problem with join ! - by El Forum - 06-17-2011, 04:00 PM
Problem with join ! - by El Forum - 06-17-2011, 05:47 PM
Problem with join ! - by El Forum - 06-18-2011, 02:20 AM
Problem with join ! - by El Forum - 06-18-2011, 03:38 AM
Problem with join ! - by El Forum - 06-18-2011, 07:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB