fazzfarrell Posted December 8, 2008 Share Posted December 8, 2008 I am currently creating a dating website - One problem I can't work is that the user is only allowed to upload 10 pictures. I want to be able to allow them to upload 10 pics only how do I go on about doing this? Quote Link to comment https://forums.phpfreaks.com/topic/136052-10-uploads/ Share on other sites More sharing options...
JonnoTheDev Posted December 8, 2008 Share Posted December 8, 2008 Run a count on the number of image records for that user in the database. If it equals 10 then dont display the upload field. Quote Link to comment https://forums.phpfreaks.com/topic/136052-10-uploads/#findComment-709360 Share on other sites More sharing options...
redarrow Posted December 8, 2008 Share Posted December 8, 2008 There are meny ways mate.... Add a field example number_of_pic were the picture names are in that row now each time a user enter a picture you need to let the database no and increment the number... <?php $sql="update picture set number_of_pic=number_of_pic+1 where user_id='$user_id'"; ?> every time the user uplaods a pic the new database field get added a 1 to it.. then do this <?php $sql="select * from picture where user_id='$user_id'"; $res=mysql_query($sql)or die(mysql_error()); while($data=mysql_fetch_assoc($res)){ if($data['number_of_pic'])==10)){ echo "To meny pictures!"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/136052-10-uploads/#findComment-709365 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.