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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:06:04+00:00 2026-05-20T23:06:04+00:00

Hey Everyone. I’m a first time poster, but I’ve browsed this site a number

  • 0

Hey Everyone. I’m a first time poster, but I’ve browsed this site a number of times. I have a coding issue that I’m not sure exactly how to solve. First I’ll explain what I need to do, and what information I have, and I hope somebody can give me a nudge in the right direction.

What I have is a spreadsheet (CSV) that has the following info: Zone Name, Zip Code, City Name. One zone should have many cities that fall under it, and every city most likely has many zip codes that fall under it. For example:

Zone H, 92603, Irvine

Zone H, 92604, Irvine

Zone J, 92625, Corona

etc.

Okay, now that that’s out of the way, here’s what I need to do with this info. I need to be able to input a city name and have it return to me all zip codes that fall under that city, as well as the zone that the city lies in. For example, if I input Chatsworth, it should give me (Zone X) and (12345, 12346, 12347) as the zip codes (just an example).

I’m not sure the best way to go about this. I could create a MySQL database and work from there, or just work from .csv files, or hardcode it into the PHP file. I don’t know how to search for a value in an array column, and then return the other columns accordingly (especially with multiple zip codes per city).

If anybody can help me out, it would be greatly appreciated. Also, feel free to let me know if you need more information from me. Thanks in advance to everyone reading.

  • 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-20T23:06:04+00:00Added an answer on May 20, 2026 at 11:06 pm

    Zone H, 92603, Irvine

    Zone H, 92604, Irvine

    Zone J, 92625, Corona

    etc.

    you can take the file and get all its contents. then split it up by new line:

    $searchCity = 'Searched'; //or whatever city you are looking for
    $file = file_get_contents('file.csv');
    $results = array();
    $lines = explode("\n",$file); 
    //use any line delim as the 1st param,
    //im deciding on \n but idk how your file is encoded
    
    foreach($lines as $line){
        //split the line
        $col = explode(",",$line);
        //and you know city is the 3rd element
        if(trim($col[2]) == $searchCity){
             $results[] = $col;
        }
    }
    

    and at the end u have an array of the results like this:

    $results = array(
       array('Zone B', '12345', 'Searched'),
       array('Zone Z', '35145', 'Searched'),
       array('Zone Q', '12365', 'Searched'),
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey everyone... I'm not too familiar with PHP... but I have PHP code that
Hey everyone, this is my first post up on StackOverflow! WOO! Anyhow, onto my
Hey everyone. I have a fair amount of experience developing iOS apps, but nothing
Hey everyone, I am trying to run the following program, but am getting a
Hey everyone, I'm back and looking forward to more of your brilliance. I have
Hey everyone, I'm using Virtual PC and working with a virtual hard disk (*.vhd)
Hey everyone. I'm trying to make a swing GUI with a button and a
Hey everyone, I'm working on a PHP application that needs to parse a .tpl
Hey so what I want to do is snag the content for the first
Hey all, my Computational Science course this semester is entirely in Java. I was

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.