Jump to content

Recommended Posts

I have some php code that supervisors use to assign work to employees. I've added a field named clerks. There are 10 clerk names in the phpmyadmin database..clerk1, clerk2, clerk3, and so on to clerk10. I need for the clerk names to be automatically added to the clerk field in the form when it is opened..for instance, if the form is opened clerk1 is automatically inserted. And the next time it is opened, clerk2 is inserted until it reaches clerk10 & then starts over by inserting clerk1....is this possible?Like I said, I have a table in the database named clerk_names & the clerk's name is listed in this table. The database name is named flow. Any help will be greatly appreciated. Thanks

Link to comment
https://forums.phpfreaks.com/topic/271961-code-help-requested/
Share on other sites

You say you've added a "field" into the database. That implies you've added that field as part of some existing table - so I'm not understanding what you mean by that. Based upon how you want to use this data I think you need a table with fields for clerk_id, clerk_name, and last_used. The last_used field will be a timestamp value to indicate the last time the clerk was used on the form. So, on each page load of the form you would run two queries: one to get the clerk with the oldest "last_used" date and another to update their "last_used" date to the current timestamp.

Link to comment
https://forums.phpfreaks.com/topic/271961-code-help-requested/#findComment-1399189
Share on other sites

I don't see the advantage in using a timestamp instead of datetime.

 

A timestamp can be set to auto-update when the record is updated but in this case it is only the timestamp itself that will be updated (SET last_used = NOW() ) so it may as well just be an ordinary datetime field.

Link to comment
https://forums.phpfreaks.com/topic/271961-code-help-requested/#findComment-1399197
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.