sanlove Posted January 26, 2014 Share Posted January 26, 2014 (edited) please help me to code image album with thumbnail. attached image for help. Edited January 26, 2014 by sanlove Quote Link to comment Share on other sites More sharing options...
adam_bray Posted January 26, 2014 Share Posted January 26, 2014 What code have you tried so far? Quote Link to comment Share on other sites More sharing options...
Barand Posted January 26, 2014 Share Posted January 26, 2014 I'll start you off with query needed. I am a bit confused by user 10 appearing twice in the output so I am assuming you want the output order by service SELECT u.int_uid , u.str_uname , s.str_sname , p.str_imagename FROM tbl_user u INNER JOIN tbl_service s USING (int_uid) INNER JOIN tbl_photos p USING (int_sid) ORDER BY s.str_sname Quote Link to comment Share on other sites More sharing options...
sanlove Posted January 26, 2014 Author Share Posted January 26, 2014 (edited) thanks . my problem is not with the query.  if one user has different services and each service has multiple images. example id user-1 has 2 services, service-1 and service-3. output willbe   output from query service1 userid1 image1 service1 userid1 image2 service1 userid1 image3 service3 userid1 image1 service3 userid1 image2 service3 userid1 image3 etc.  using php code i need to display service1 userid1 (image1,image2,image3) then service3 userid1 (image1,image2,image3)  please help. Edited January 26, 2014 by sanlove Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted January 26, 2014 Share Posted January 26, 2014 You'll need to add extra logic to your while loop so it only displays the service and name once, and then lists the images, Quote Link to comment Share on other sites More sharing options...
Barand Posted January 26, 2014 Share Posted January 26, 2014 Easiest way is to store the data in an array as you loop through the query results $data[$service][$user][] = $image Then use a couple of nested foreach loop to display the data Quote Link to comment Share on other sites More sharing options...
sanlove Posted January 26, 2014 Author Share Posted January 26, 2014 if possible please give code. thanks in advance. Quote Link to comment Share on other sites More sharing options...
Barand Posted January 26, 2014 Share Posted January 26, 2014 Have a try yourself first and come back when you get stuck Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.