Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,136 members, 7,818,422 topics. Date: Sunday, 05 May 2024 at 03:06 PM

List Of All States With Local Governments In Nigeria In JSON, PHP And SQL Format - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / List Of All States With Local Governments In Nigeria In JSON, PHP And SQL Format (10072 Views)

Jamb Past Questions API In JSON / Programming Challenge: Convert String to Json with a Loop / Please Kindly Help With This JSON Code (2) (3) (4)

(1) (Reply) (Go Down)

List Of All States With Local Governments In Nigeria In JSON, PHP And SQL Format by timotew: 12:05pm On Jun 16, 2015
For those that had it and never shared it, Shame on you God bless Nigeria.
All states and local governments in Nigeria in JSON, PHP and MySQL readymade in format/Structure.
I believe this is useful to all programmers respective of the language you code in because JSON data structure cut across all languages.
I was able to give all States and Local Governments and Index ID which make it easy for you to use both JSON and MySQL format together without sending a Query into the database, The ID in the JSON will be used as the index ID in the MYSQL tables for states and local Governments.
I have included JQuery to avoid cross browser issues in the JavaScript but if you don’t user JQuery you can easily crack it into a native code, but the JS code might be longer.
See the Demo Below to see how it’s done:
//START CODE
(The post was too long, use the link below to view the code)
//END CODE
Using it as above will really save you time from writing bunch of AJAX codes to request for a whole select box.
I will recommend that you keep the nigeria variable in a separate javaScript source file.

Here is the MySQL data that rhyms with the nigeria vars.

This might be a very long scroll:

//MYSQL STATRT (You can copy and send this as query directly into you database.)
(The post was too long, use the link below to view the code)
//MYSQL END
I case you have errors with this data it might be that the forum text editor has modified it.

To be sincere I had to got through wikipedia and extract the whole table as it was arranged and make the arrangement alphabetically using just a mini extractor I created through the night with JavaScript/PHP codes
I am mentioning this in case you are faced with the-same situation which might not be exact, This will give you have to bypass some of those long queue of copy and paste.

You can download the complete source code in a zip package and tutorial on how the extraction of all states and local governments
from wikipedia was converted to JSON and MySQL on my blog: http://www.codingsavvy.com/2015/06/convert-raw-html-data-into-jsonphp-and.html

5 Likes 2 Shares

Re: List Of All States With Local Governments In Nigeria In JSON, PHP And SQL Format by larisoft: 10:17am On Jun 17, 2015
Wonderful work, bro!

Just thinking..wouldnt it be wonderful if the whole thing was provided as a webservice? That way you can make calls like www.naijadatasite.com?info=lg&format=json and get a json,xml or array (i.e. anambra north, anambra south, ) response.

If it was done this way, more and more info could be added over time. It will be really useful to a lot of developers.

Thanks for your wonderful work!

2 Likes

Re: List Of All States With Local Governments In Nigeria In JSON, PHP And SQL Format by timotew: 11:58pm On Jun 17, 2015
larisoft:
Wonderful work, bro!

Just thinking..wouldnt it be wonderful if the whole thing was provided as a webservice? That way you can make calls like www.naijadatasite.com?info=lg&format=json and get a json,xml or array (i.e. anambra north, anambra south, ) response.

If it was done this way, more and more info could be added over time. It will be really useful to a lot of developers.

Thanks for your wonderful work!

Great Suggestion I will Look Into that.
Thanks.
Re: List Of All States With Local Governments In Nigeria In JSON, PHP And SQL Format by webguru(m): 4:55am On Jun 20, 2015
put it on github

1 Like

Re: List Of All States With Local Governments In Nigeria In JSON, PHP And SQL Format by Nobody: 6:13am On Jun 20, 2015
We need it as a web service. . . .that way, we can connect to it from android and ios apps, as well as php apps. And make sure you provide a dedicated server for it otherwise we go crash your server with requests.
Re: List Of All States With Local Governments In Nigeria In JSON, PHP And SQL Format by Nobody: 6:22am On Jun 20, 2015
Excellent i just "linted" it so that I can read it with my eyes before feeding it to my apps, and it came to ehm 3246 lines. Most importantly, it validated and it is properly structured. I wonder how you were able to compile it, if it is easily reproducible. . .then it can be implemented.
Re: List Of All States With Local Governments In Nigeria In JSON, PHP And SQL Format by aristosoft(m): 1:51pm On Jul 04, 2015
dhtml18:
Excellent i just "linted" it so that I can read it with my eyes before feeding it to my apps, and it came to ehm 3246 lines. Most importantly, it validated and it is properly structured. I wonder how you were able to compile it, if it is easily reproducible. . .then it can be implemented.

Why can't we start it as a simple open-source project and API.....just like randomuser.me

I can volunteer to register a domain name and service, we can build it on Cloud 9. I will create a project there and we all can connect and contribute.
Re: List Of All States With Local Governments In Nigeria In JSON, PHP And SQL Format by timotew: 7:20pm On Jul 04, 2015
aristosoft:

Why can't we start it as a simple open-source project and API.....just like randomuser.me
I can volunteer to register a domain name and service, we can build it on Cloud 9. I will create a project there and we all can connect and contribute.
I have already purchase the domain name:
http://ngquery.com/

The Aim is to enable developers to send request to the server and get their reply ASAP
Anyone willing to volunteer to build the site or contribute to it should please reply.

3 Likes

Re: List Of All States With Local Governments In Nigeria In JSON, PHP And SQL Format by pumpindkay(m): 7:53pm On Jul 04, 2015
@op thanks. I ve been looking for something similar world country and states
Re: List Of All States With Local Governments In Nigeria In JSON, PHP And SQL Format by elfico(m): 9:54am On Sep 17, 2015
timotew:

I have already purchase the domain name:
http://ngquery.com/

The Aim is to enable developers to send request to the server and get their reply ASAP
Anyone willing to volunteer to build the site or contribute to it should please reply.
Am very interested in this project. How can I help? I sent you a mail.
Re: List Of All States With Local Governments In Nigeria In JSON, PHP And SQL Format by chiwex(m): 10:28pm On Sep 18, 2015
are u looking for a php, JavaScript, laravel, html and css, joomla, wordpress professional website developer or tutor

call: 08186311863
email: donchiwexco@gmail.com
Re: List Of All States With Local Governments In Nigeria In JSON, PHP And SQL Format by benpaul320: 3:30pm On Jan 26, 2022
https://github.com/Benpaul320/nigeria-state-city-api

Hi, you can use this API, you get the states and all cities in that state. the API is awesome that's what i use.

(1) (Reply)

Is C++ Still A Relevant Programming Language Today? / What Does It Take To Develop An Ecommerce Site Like Ebay & Amazon / Gdevit.com Finally Completed Guys!!

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 24
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.