Need Help With Exploding CSV Data Within DB |
[eluser]Jay Logan[/eluser]
That looks like something that could almost work. I'm trying to understand it better. The way the site works is a page is loaded based on the id_name. EX: www.site.com/profile/houston. The id_name is houston. So I need to retrieve all zip codes associated with houston in the database. The column containing the zip codes is addr_assoc. In another table, I have information about all zip codes. So if houston is associates with 12345, 12346, 12347, 1238, etc. then I need to pull all records from the zip code table that have those as the zip_code. Some zip codes will be in there more than once and I would want to pull that info too.
[eluser]johnwbaxter[/eluser]
Then just do the query to bring back all records that match houston and do a for each on the result set to make a where_in select statement for each one.
[eluser]Jay Logan[/eluser]
I think I have it figured out. New problem is removing the duplicates. In the zip code table, zip_codes can be different but county_names could be the same. Or even zip_codes could be the same and county_names could be different. Thank you guys for your help. I learned a lot from this.
[eluser]Jay Logan[/eluser]
And here is the code I ended up using. Code: function get_zips($id_name)
[eluser]Jay Logan[/eluser]
Figured it out. Here is the final code I will be using. Code: function unique_counties($id_name) I have to make a new function for each item I want to be unique (city, state, etc.) but it works well. Let me know there is any better way of doing this. Thanks again.
[eluser]johnwbaxter[/eluser]
What is this, what does it do? "$this->clean_result($result);" You could put in $this->db->free_result directly after this line:$get_data = $this->db->get('VSS_src_network'); which would be errrr good.
[eluser]Jay Logan[/eluser]
clean_result is this function that was used on one of my other sites. Another programmer made it and it was the only way I knew to get the result to display in my view correctly using code like: Code: <? foreach ($counties as $row): ?> Here is the function. Code: function clean_result(&$ci_result) I'll try out free_result. |
Welcome Guest, Not a member yet? Register Sign In |