Pictures Approoving

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
mbaroz
Forum Commoner
Posts: 29
Joined: Sun Feb 05, 2006 10:10 am

Pictures Approoving

Post by mbaroz »

Hi All
I would like to implement a photos uploaded an approval process, in my web site , so Members that uploaded a picture , will be in a waiting status for picture to be approoved.

i have the Picture name known in my php code, and i would like to set a flag in the Database for each picture that is approoved or not. there are only 2 status : approoved / not approved.

My question is how to use the DB structure if i know that in the future i will have like more than 4 pictures ?

thanks
Moshe
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Pictures Approoving

Post by John Cartwright »

mbaroz wrote:My question is how to use the DB structure if i know that in the future i will have like more than 4 pictures ?
What do you mean, more than 4 pictures? I thought this was about an approval process, so I'm going to assume you meant to say 4 different flags in the database. Well, according to normalization, you would seperate the flags into their own respective table, and perform an inner join to combine the tables.

TABLE - Status

Code: Select all

ID | DESCRIPTION
0    Pending
1    Approved
2    Declined
..etc
TABLE - Pictures

Code: Select all

ID | STATUS_ID | PICTURE
0    0           jcart.jpg
1    2           bleh.jpg
2    2           bleh.jpg

Code: Select all

SELECT * FROM `pictures` INNER JOIN `status` ON `status`.`id` = `pictures`.`status_id`
Enjoy
Post Reply