Get Images of an Article |
09-27-2018, 12:47 AM
(This post was last modified: 09-27-2018, 12:48 AM by demyr. Edit Reason: typing mistake )
Dear @php_rocs, I followed your advice and ran the query first in my phpMyAdmin. It helped me to get the idea. However, I couldn't solve my problem at first.
Then I went on watching some other videos instead writing here for a further help. And I did! For example, the video (or even the series) which helped me a lot on YouTube was this Relational Table Joins as it shows the JOIN method together with controller and view part in a clean way. (Maybe it might help others, that's why I'm sharing.) I will have another question at the end, after sharing my working JOIN here: MY MODEL (which has a seperate function following @jreklund's advice) PHP Code: function images($productslug){ MY CONTROLLER : PHP Code: public function products($pcategoryslug, $productslug) MY VIEW : PHP Code: <?php foreach($photo as $p) { ?> What I have learnt and what is my question now: As you can see, I have learnt how to use controller. Collecting each part on $data['...'] or using the methods which effect the URL.. Even the order of it!! This video helped me a lot about this URL issue : URL Routing . And my question: As you can see, I did not join my tables using 'id' which is a classical because I got problem with the url. I had to use id within my url like ../product/product-ABC/4 . 4 is the id. Since I couldn't remove it from the url I did all the JOIN methods and rest working on the "slug", which I thought is unique as well. Not unique in DB way, but I have never seen any company having 2 products with the same name There must always be a difference in the name like product-ABC and product-ABC3 . Is it a rational way? What would you recommend and if you recommend in ID way again, how can I reshape my URL ? Thank you all for all the answers and Kind regards, |
Messages In This Thread |
Get Images of an Article - by demyr - 09-16-2018, 06:07 AM
RE: Get Images of an Article - by jreklund - 09-16-2018, 09:46 AM
RE: Get Images of an Article - by demyr - 09-16-2018, 10:45 PM
RE: Get Images of an Article - by php_rocs - 09-17-2018, 07:49 AM
RE: Get Images of an Article - by Wouter60 - 09-17-2018, 08:42 AM
RE: Get Images of an Article - by demyr - 09-27-2018, 12:47 AM
RE: Get Images of an Article - by Pertti - 09-27-2018, 01:15 AM
|