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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:36:14+00:00 2026-06-10T19:36:14+00:00

I am downloading new csv’s each night using a cron job with PHP. Each

  • 0

I am downloading new csv’s each night using a cron job with PHP. Each csv is normally about the same, possibly one night within a month a field is new. I need to get the new field and append it to the database. I don’t know how to get the type of the new field. I saw someone else’s question with gettype() but i’m not sure if that would work or not since the data is inside a csv so wouldn’t they all be strings when some need to be floats, or ints? How would I go across checking the type?

The second question, is there a way to check if there is not a name inside of a table? For instance, if they add a new field called foo52, and I have foo1 through foo51 in my database, is there a quick way to search for fields that aren’t there, or would I have to use a select statement for each one and append it when it’s false?

I use MySQL for my database.

Thanks for your help.

  • 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-10T19:36:15+00:00Added an answer on June 10, 2026 at 7:36 pm

    The first question on the part about getting the type is the simply try the conversion of the data itself and then seeing if the data is equivalent with a == comparison.

    So,

    some,data,is,123
    

    After reading in the data you can then try the conversion to various types such as strings, ints, ect…then from that you are able to determine the type of the data.

    For the second question you can get the column names by doing:

    show columns from db.table_name
    

    Then you can do a simple in_array to test if the new column name is already in the database.

    EDIT:

    Using array_diff can simplify the finding of the missing/new column names from the CSV.

    csv_names = get_csv_column_names();
    sql_names = get_sql_column_names();
    
    new_names = array_diff( csv_names, sql_names );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was just downloading a new distro of linux using uTorrent, and started to
I am trying to load multiple symbols using a csv file rather than downloading
I'm downloading a PDF in my application using: Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(*url
I'm quite new to Amazon S3 and I'm having difficulty downloading large files from
I am downloading some information from a JSON feed about countries, states and their
i am downloading an application in Android using the DownloadManager class. When the download
Within my application there is alink to to appstore for downloading the new version
I'm downloading a file, supposedly a .csv file, from an external URL with the
As a preface, I am brand new to using SQL Server 2005; I know
After upgrade to Snow Leopard and downloading the new Xcode along with all new

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.