Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9156993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:54:15+00:00 2026-06-17T12:54:15+00:00

I am new to programming so there may be a simple solution to my

  • 0

I am new to programming so there may be a simple solution to my problem.

What I am trying to accomplish is finding duplicate fields entries in a MySQL column the entries are going to be dates example 01/20/13

I need to search through the date field and determine how many duplicate entries there are for a date then upon finding out the number I need to create a loop that will take the date change it into the name of the day the date is then add a . and a number after the .

So for example 01/20/13 is Sunday so in my database example below there are 4 duplicate entries so the output needs to be Sunday.1, Sunday.2, Sunday.3, Sunday.4

I have this functionality working in the PHP program below but I need it to search for duplicates in a 7 day range example 01/20/13 - 01/26/13, starting with Sunday and ending with Saturday. I don’t want to hard code a weeks worth of date values in. That is where my problem lies I don’t know where to go from here I am stuck. I can only think of hard coding the weeks worth of values in to get the desired results but I know there is an easier way.

My PHP code:

<?php

    require '../TimeCard/DB.php';

    $i = 1;

    try{
    $stmt = $conn->prepare('SELECT `date` FROM `timeRecords` WHERE `employeeID`= 1 ORDER BY date ');
    $stmt->execute();
    } catch(PDOException $e){
        echo'ERROR: ' . $e->getMessage();
    }

    while($row = $stmt->fetch())
  {
    if ($row['date'] == "01/20/13"){

        $date = date("l", strtotime($row['date']));
        $$date = "Hello today is " . $date . "." . $i . "<br>";
        echo $Sunday;
        $i++;
    }
  }

?>

Database:

+----+------------+----------+--------+-------------------+-----------+------------+-----------+---------+
| id | employeeID | date     | timeIn | jobDescription    | equipType | unitNumber | unitHours | timeOut |
+----+------------+----------+--------+-------------------+-----------+------------+-----------+---------+
| 10 |          1 | 01/20/13 | 20:30  | Blah1             |           | 01E        |      NULL | NULL    |
|  2 |          1 | 01/20/13 | 1:00   | Test              |           | 02S        |      NULL | NULL    |
|  9 |          1 | 01/20/13 | 13:00  | Blah12            |           | 02E        |      NULL | NULL    |
|  8 |          1 | 01/20/13 | 6:00   | Blah              |           | 02D        |      NULL | NULL    |
|  1 |          1 | 01/21/13 | 09:12  | Worked in hubbard | Excavator | 01E        |      8375 | 09:14   |
|  3 |          1 | 01/22/13 |        |                   |           | NULL       |      NULL | NULL    |
|  4 |          1 | 01/23/13 |        |                   |           | NULL       |      NULL | NULL    |
|  5 |          1 | 01/24/13 |        |                   |           | NULL       |      NULL | NULL    |
|  6 |          1 | 01/25/13 |        |                   |           | NULL       |      NULL | NULL    |
|  7 |          1 | 01/26/13 |        |                   |           | NULL       |      NULL | NULL    |
+----+------------+----------+--------+-------------------+-----------+------------+-----------+---------+
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:54:16+00:00Added an answer on June 17, 2026 at 12:54 pm

    Your approach seems to be too complicated. Find count for today’s date and given employee instead.

    
    SELECT date, COUNT(*) FROM timeRecords 
      WHERE employeeID = 1 AND date BETWEEN DATE_SUB(NOW(),INTERVAL 1 WEEK) AND NOW() 
      GROUP BY date
      ORDER BY date DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm fairly new to programming, and there's one thing I'm confused by. What is
Hey there, I'm a designer thats really new to programming with xcode or Objective-C
I am new to iOS programming. I see that there are functions defined in
I am new to cocoa touch programming. Is there a widget/control in cocoa touch
Hey there, I'm sort of new to Objective-C, and well, programming in general. I
Is there any reason I shouldn't do this? I'm fairly new at programming iPhone
New to Linux programming in general. I am trying to communicate with a kernel
I'm new to three.js and 3d programming in general, so this may seem like
I'm relatively new to web-programming in general so my question may seem a little
I am new to android programming and trying to use webservice in this sample

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.