Web Hosting Geeks | Web Hosting Experts
Need help? Call us 1(866)TOP-HOST

14625 reviews 1734 hosting providers

Questions & Answers

php /displaying pictures form database depending on users

Feb 9, 2013 by A007
Hello

In my pho page, I have a table with registered users pictures that is accessible only by logged in users. I want to output the picture of the specific user that is logged in on the user’s front end home page. How can I do that? Can anyone please help?
Any suggestions would be highly appreciated
Thanks

1 Answer

0 votes
Feb 9, 2013 by SmartHost
You need to store all your pictures in a directory, and name the images as the username.jpg. The in your table column, such as "prof_pic", set the image's file name. Then you need to create a way to relate the picture ID with the login_name. So now when the user logs in, make a function that looks for the username.jpg  and displays it and if it’s not found then nothing loads.