Problem with join ! |
[eluser]jmadsen[/eluser]
@NETACCESS - Your code looks correct to me. Put Code: $this->db->last_query(); Code: $query = $this->db->get('projetsPortfolio'); 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 :-)
[eluser]NETACCESS[/eluser]
Hi, thank you for the answer. I have couturn the problem and it work. I think its not very pro and secure ... In the foreach who show the projects in the view, i call a function of my model who show the pics. here is the code ! Code: <?php foreach($projects as $r): ?>
[eluser]jmadsen[/eluser]
sorry, but terrible design 1) don't call models from views 2) just fix your query or the actual problem. if you post the code like I suggested, we might be able to help
[eluser]Nick_MyShuitings[/eluser]
Second suggestion: Avoid Active Record... Just write the query and use query bindings... enjoy all the security Active record provides, and ignore all the hassle of trying to write or troubleshoot complicated queries... plus a speed advantage. |
Welcome Guest, Not a member yet? Register Sign In |