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

  • Home
  • SEARCH
  • 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 957309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:40:52+00:00 2026-05-16T00:40:52+00:00

I know I know, a database would be the better idea with what I

  • 0

I know I know, a database would be the better idea with what I want to do, but I don’t want the hassle of dealing with a database and learning stuff.

I have a CSV that has something similar to

TestUser,2010/07/27 13:26:25,2010/07/27 13:26:29,0.0011,0.0006,0.06
TestUser,2010/07/27 14:22:12,2010/07/27 14:22:24,0.0033,0.0027,0.27
TestUser,2010/07/27 14:22:41,2010/07/27 14:22:53,0.0033,0.0028,0.28
TestUser,2010/07/27 14:25:26,2010/07/27 14:25:33,0.0019,0.0015,0.30

the 2nd column is what I am using as a UID (unique ID), so it will never be the same in the CSV. The PHP code I use to write to the csv is:

$myFile = "data.csv";
$fh = fopen($myFile, 'a') or die("can't open file");

$stringData = $_POST["Name"].",".$_POST["DateStart"].",".$_POST["DateStop"].",".$_POST["TotalHours"].",".$_POST["Hours"].",".$_POST["Pay"]."\n";
fwrite($fh, $stringData);
fclose($fh);

What would need to be done to have it so if someone with the same DateStart (the UID) runs the PHP, it will overwrite whatever has that same UID. Basically I am thinking it would probably have to go through an file array with each line and then when it reaches a line that has the same UID, it would instead intercept what was POSTed and not what it has.

I am not sure if that is the best way of going about what I want.

  • 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-05-16T00:40:52+00:00Added an answer on May 16, 2026 at 12:40 am

    While I completely agree with ircmaxell (learn to use a database), you still deserve a proper response to the question.

    I do believe you would have to read line by line and do the comparison. No, it’s not very efficient, but your setup doesn’t really allow for efficiency.

    “I am not sure if that is the best way of going about what I want.”
    As ircmaxell suggested, using a database would be incredibly simple. mysql is free and is a piece of cake to pick up. Something as simple as this will be able to be hammered out in a couple hours tops.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.