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 8186657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:17:12+00:00 2026-06-07T02:17:12+00:00

So I have this script that parses through a file and inserts data into

  • 0

So I have this script that parses through a file and inserts data into my DB. But now the files I’m looking at have a bunch of random text(basically a key for the rest of the log) before the stuff that I need. So I need to find the timestamp in the file and then operate as I usually would from there, ignoring all the stuff before the timestamp. The logs look like this-

(Blah blah, random stuff)

'2004-05-12 15:45:00',0,0,0,141713,,123.288,122.449,123.2...

And heres my code for once I ‘hit’ the timestamp, storing the values in an array-

// read and store the values in an array
while (($buffer = gzgets($fp, 8192)) !== false)
        {
        $val[$i] = $buffer;
        $i++;
    }
    $qry = "insert into afeed 

    set time_stamp='".$val[0]."', 
    error_value='".$val[1]."',
    firstThing='".$val[2]."',
    ...
    otherstuff='".$val[12]."',
    lastThing='".$val[13]."'";

}

So either look for timestamp and start from there, or I was thinking that since all the useless stuff in the beginning is the same every time I could find out the size of it and ‘skip that many bytes’?

Any of this possible?

  • 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-07T02:17:14+00:00Added an answer on June 7, 2026 at 2:17 am

    Both of your potential solutions are possible. The “skip that many bytes” solution would probably be the most straightforward. If you know ahead of time that the length of the useless stuff is going to be, for example, 64 bytes at the beginning of every file, you can use something like gzseek($fp, 64) to move the file pointer past the useless stuff.

    Since you said the useless stuff is the same every time, this should work. If the useless stuff is not a predetermined length, this method could still be used once you determined how long the useless stuff is (I’d need to see what the useless stuff is to decide on the best method for doing this).

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

Sidebar

Related Questions

I have this script that collects data from users and I want to check
I have this script that works, but I need to change the format of
I have this content script that downloads some binary data using XHR, which is
On a webserver, I have a php script that parses a .sql file (which
I have a script that takes an uploaded text file, parses it and then
I have a php script that steps through a folder containing tab delimited files,
I have this script that run to fix my menu bar to the browser
I have this jQuery script that works fine: $(select).change(function () { var finalPrice =
I have this simple script that I'm working on. I must admit, I'm totally
I have this ruby script that allows me to enter the name of a

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.