raduenea Posted April 15, 2012 Share Posted April 15, 2012 In witch conditions you need to transfer the data from a select in array and after that to show from array in content of the page ? Quote Link to comment https://forums.phpfreaks.com/topic/260964-select-to-array/ Share on other sites More sharing options...
mofm Posted April 15, 2012 Share Posted April 15, 2012 In witch conditions you need to transfer the data from a select in array and after that to show from array in content of the page ? I have no idea what you are asking and i don't think anyone else will, try rewording your question. Quote Link to comment https://forums.phpfreaks.com/topic/260964-select-to-array/#findComment-1337475 Share on other sites More sharing options...
raduenea Posted April 15, 2012 Author Share Posted April 15, 2012 I have two tables : one with users and another one with the number of images that they have uploaded. I mentioned that some images have the option to show or not in the site. I want to show all the users with a picture on every user (take from table 2 if the picture exist), and to show the number of images that he uploaded. If the user don't have any images uploaded he must not appear. That's why I asked if it's necessary to show all this from an array for a better organization. Please tell me know how can I do that. Thks Quote Link to comment https://forums.phpfreaks.com/topic/260964-select-to-array/#findComment-1337578 Share on other sites More sharing options...
RickXu Posted April 16, 2012 Share Posted April 16, 2012 If you do have `user_id` in your `images` table, you can easily get around this by query: SELECT `images`.`img`, COUNT(`images`.`id`) AS count_img, `users`.* FROM `images` LEFT JOIN `users` ON `images`.`user_id` = `users`.`id` GROUP BY `images`.`user_id` In this way, users who didn't upload any image wouldn't even be included in the return results. Not sure if this is what you're expecting. Quote Link to comment https://forums.phpfreaks.com/topic/260964-select-to-array/#findComment-1337684 Share on other sites More sharing options...
raduenea Posted April 16, 2012 Author Share Posted April 16, 2012 The structure of this two tables is: user table: - id - firstname - lastname - company - address - phone - email images table: - id - user_id - picture_title - year - visible - picture_path I must notice that the user can hide the pictures. So he can have picture in images table but hide (visible column). Quote Link to comment https://forums.phpfreaks.com/topic/260964-select-to-array/#findComment-1337738 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.