how to store images of a unique user in mysql using php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ryanfern86goa
Forum Newbie
Posts: 16
Joined: Tue Sep 22, 2009 5:26 pm

how to store images of a unique user in mysql using php

Post by ryanfern86goa »

hi there

I have been learning php and mysql for past about 20days now... i have created a user login and registration system and wondering how to allow a particular user whose unique or primary in the mysql table to upload and retrieve pictures.

Any help would be appreciated.

thanks
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: how to store images of a unique user in mysql using php

Post by califdon »

If you've already created the login and registration, just check whether the user is logged in before sending the picture uploading/retrieving page. If they aren't, just send a page that says "Sorry, you aren't logged in." This is usually accomplished by saving a token as a session variable when a user successfully logs in. Then you only have to check the session variable for any subsequent controls. Review "session variables" in your PHP instructions.
Griven
Forum Contributor
Posts: 165
Joined: Sat May 09, 2009 8:23 pm

Re: how to store images of a unique user in mysql using php

Post by Griven »

I recommend reading through this tutorial from Tizag about uploading files: http://www.tizag.com/phpT/fileupload.php

In addition to uploading the image to your server, you'll also want to store the path to the image in the database, along with all the other data for that user.
xtiano77
Forum Commoner
Posts: 72
Joined: Tue Sep 22, 2009 10:53 am
Location: Texas

Re: how to store images of a unique user in mysql using php

Post by xtiano77 »

http://www.php-mysql-tutorial.com/wikis ... abase.aspx

I would check out the link above on how to upload files into a database. That is what I used as go by to wrap my head around the concept and the steps on how to do it. Hope this helps. Cheers!
ryanfern86goa
Forum Newbie
Posts: 16
Joined: Tue Sep 22, 2009 5:26 pm

Re: how to store images of a unique user in mysql using php

Post by ryanfern86goa »

thanks all for ur advice
Post Reply