Jump to content

mstoehr

New Members
  • Content Count

    9
  • Joined

  • Last visited

Community Reputation

0 Neutral

About mstoehr

  • Rank
    Newbie
  1. $row_admin['total_staff'] = 5; //set in loop above $current_pick_staff = 1; //changes on page load AAAAWWWW: $sql = "SELECT * FROM vac_pick_order WHERE pick_order ='$current_pick_staff'"; $result = mysqli_query($conn, $sql); while($row = mysqli_fetch_assoc($result)){ if($row77['vac_c_counter'] > 0){ //<---- this is where the GOTO is needed if this goto the next staff member $current_pick_emp_num = $row77['emp_num']; }ELSE{ if ($current_pick_staff == $row_admin['total_staff']){ $current_pick_staff = 1; }ELSE{ $current_pick_staff++; } $sqla = "UPDATE vac_admin SET
  2. Thank you for your input. Got it working now!!
  3. That's a great bit of code Thanks. But i still have a problem. As the loop continues staff run out of vacation weeks therefore they need to be skipped and the next person can pick in the round. How do i skip a staff member that has run out of days to pick? The vac_pick_order -> vac_c_counter starts at the amount of vacation the staff is given and every week they pick is deducted from that count. When its 0 they should be skipped and the next person can pick. $qq = ($row_admin['current_pick_staff'] + $row_admin['current_round_number'] - 2) % ($row_admin['total_staff']) + 1; $sql = "
  4. This is my DB structure ~~~~~Table ~~~~vac_admin Id | pick_year | current_pick_staff ------------------------------------------------------------- 1 | 2020 | 1 ~~~~~Table ~~~~vac_pick_order Id | pick_year | pick_order | vac_c_counter | emp_number ------------------------------------------------------------------------------------------------------------- 1 | 2020 | 1 | 3 | 11111111 2 | 2020 | 2 |
  5. Man i just can't wrap my head around this bit of code 😫😫 I have been trying all day still not the result i need.
  6. SORRY I made a BIG ERROR explaining what i need . In every round the order changes by 1 every time ~~~~~~First round of picking~~~~~~ STAFF 1 - PICK ORDER 1 - 3 weeks available STAFF 2 - PICK ORDER 2 - 5 weeks available STAFF 3 - PICK ORDER 3 - 3 weeks available Staff 1 takes 2 Weeks Staff 2 takes 1 Weeks Staff 3 takes 3 Weeks ~~~~~~Second round of picking~~~~~~ STAFF 2 - PICK ORDER 1 - 4 weeks available STAFF 3 - PICK ORDER 2 - No weeks left STAFF 1 - PICK ORDER 3 - 1 weeks available Staff 2 takes 3 Weeks Staff 3 Skipped Staff 1 takes 1 Weeks
  7. I have 3 staff members that need to pick vacation in a certain order. Each have X weeks vacation and can pick off a calendar their choice 1-3 weeks per round. I'm trying to loop through the DB to find who is next to pick with weeks left ~~~~~~First round of picking~~~~~~ STAFF 1 - PICK ORDER 1 - 3 weeks available STAFF 2 - PICK ORDER 2 - 5 weeks available STAFF 3 - PICK ORDER 3 - 3 weeks available Staff 1 takes 2 Weeks Staff 2 takes 1 Weeks Staff 3 takes 3 Weeks ~~~~~~Second round of picking~~~~~~ STAFF 1 - PICK ORDER 1 - 1 weeks available STAFF 2 - PICK O
  8. I'm trying to get dates out of the DB for an overtime system. The dates are for staff with the oldest seniority first to the newest staff last. But when 2 or more people start on the same date. I need to randomly order them every time i make a query to the DB In my database, there is a column called start_date. I need to select all the dates in order of oldest date to newest date. $sql = "SELECT * FROM staff ORDER BY start_date DESC"; That's easy BUT... If there are 2 or more of the same start dates selected those dates in random order OUTPUT Example: 1988-01-01 <-- ol
×
×
  • 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.