Hey Guys,
I have a website, in which a user can choose to predict soccer games every week, but in order for him/her to predict the week, they need to buy it first. I have no problems with the buying part, but the data of the weeks bought should be entered into a database. I have three rows in my data base: username, pass, weeksbought.
Now, I have a page that checks what weeks were paid, it consists of a list that looks like this: (EX.1)
Week 1
Week 2
Week 3
Week 4
etc...
Right next to those values, there will be a word displayed. so say a user bought week 1 and 3 it would do this:
Week 1 Paid
Week 2 Unpaid
Week 3 Paid
Week 4 Unpaid
...
So I need to somehow check with the database whether a week was paid or not. Can the row weeksbought display numbers separated by a comma? something like this?
1,3
If so, How can I read from those weeks into the PHP file that displays what weeks were paid and what weeks were unpaid? (refer to EX. 1)
Thank you sooooo much people.
Yours,
Yuval Karmi
DataBase
Moderator: General Moderators
- aaronhall
- DevNet Resident
- Posts: 1040
- Joined: Tue Aug 13, 2002 5:10 pm
- Location: Back in Phoenix, missing the microbrews
- Contact:
If you haven't already, set up your table so that there is one row for every week paid.
As long as you have the userID, you can easily query the database for all weeks paid, or check if a single week has been paid.
Code: Select all
create table weeks_paid (
id int(11) auto_increment not null,
userID int(11),
week_number int,
primary key(id)
)