Jump to content

Field status change


atl_andy

Recommended Posts

Is there a way to limit data from being entered into a row?

 

Example:

 

I have 3 rows of data in my database:

 

ProjectNumber  ModelNumber    SerialNumber  Open/Closed

12345              xyz                  234234            Open

12345              xzs                  13514              Open

12345              asdf                13451              Open

 

I would like to flag everything for project 12345 so that no more data can be entered using that project number, once it is complete.  Maybe there is an update I can run to mark it as such?  By changing the status to closed.

Link to comment
https://forums.phpfreaks.com/topic/97700-field-status-change/
Share on other sites

I would create Projects table (if you haven't already). The primary key would be ProjectNumber, then there could be other info about it like Title, Owner, etc. Then, have a final datetime column called closed_dttm. Leave this column null while open, then fill it with the date when closed.

 

Make sense?

Link to comment
https://forums.phpfreaks.com/topic/97700-field-status-change/#findComment-500084
Share on other sites

  • 3 weeks later...

You could create a trigger on update which checks to see if a row is open or closed, if you want to prevent changes directly in SQL.

 

But I think it makes more sense to check it in the software.  If someone wants to add a row, first check the table to see if there are any rows that are closed and have matching project number.

Link to comment
https://forums.phpfreaks.com/topic/97700-field-status-change/#findComment-513497
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.