Page 1 of 1

Pictures Approoving

Posted: Sun Mar 18, 2007 2:24 am
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

Re: Pictures Approoving

Posted: Sun Mar 18, 2007 2:54 am
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