Jump to content

help with database/form design


Jakebert

Recommended Posts

Hi everyone,

 

I'm trying to design a mock parliament: there is a bill up for vote, everyone may vote once (either AYE or NAY), but they can switch their vote.

 

I tried it with a table VOTES with columns for BILLID (the id of the bill up for vote), USERID (the user voting) and VOTE (what they voted). The actual number of votes for each bill is stored in table BILLS.

 

In the PHP processing the form, i have to check everything twice, i.e. did they click yes or no? if they clicked yes have they clicked yes before? have they voted no before? if they voted yes before display an error, if they voted no before remove 1 from nay and add one to ay, and then update table VOTES. And then all over again if they voted no. it looks like spaghetti.

 

 

Can anyone think of an easier/more compact way to do this?

Link to comment
https://forums.phpfreaks.com/topic/264201-help-with-databaseform-design/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.