TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   uploading images into a tabe by multi users (http://www.talkphp.com/absolute-beginners/2970-uploading-images-into-tabe-multi-users.html)

sarmenhb 06-17-2008 12:56 AM

uploading images into a tabe by multi users
 
hi, im creating a script that will allow multiple users upload multiple images and will view the images only that they uploaded.

this is the table structure i used

Code:


id
username
title
image

as you can see i added the username column which will be grabbed from the cookie. now my question is , is this the right way of doing this? if i had 100 people login to this script and each person uploaded 10 images to this table and their images were displayed neatly to them in a table. how else can this be done?
thanks

ps: this is what the table might have looked like after having 3 people upload 5 images each.

Code:


id: 1
username: bob
title: cartoon
image: someimage.png(encoded)

id: 2
username: bob
title: balloons
image: someimage.png(encoded)

id: 3
username: bob
title: ocean
image: someimage.png(encoded)

id: 4
username: bob
title: pc
image: someimage.png(encoded)

etc.....

then when i want to display each users images i would run a query like this

Code:


$username = $_COOKIE['username'];
$sql = mysql_query("select * from tbl_logos where username = '$username'");

while($row = mysql_fetch_assoc($sql)) {

echo data.....

}


Jim 06-20-2008 02:51 PM

So if i understand correctly you are saving an image by username, and you get the username from a cookie?

That wouldnt be smart since everybody can change their cookie information.


All times are GMT. The time now is 07:06 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0