I have SQL file with US zip codes (over 41000 lines of code). I want make a plugin that inserts this SQL file into WP database so user can do a search by zip codes. I want to insert SQL with PHP rather than PhpMyAdmin
closed as off topic by toscho♦ Jul 5 '12 at 21:26
Questions on WordPress Answers are expected to relate to WordPress within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.
I have not created a plugin that does what you want, but I have been playing with a plugin that creates its own tables. The plugin in comes with an SQL.txt file in case your WordPress install does not have permissions to create tables (in which case you would have to manually run the SQL file)
So it seems that a plugin that creates tables could potentially be problematical during install.
Another thing that this same plugin does is use an array from another file to display things. This seems like it would be a better approach because you would not have to mess with people's DB, and you could easily update the file that holds your array of zip codes.
Here is some of the code it uses for doing that: