Your Church’s CCB City, State Dashboard

Yes, another week has passed as fast as the speed of light.

It’s time for another tutorial.

This week I’ll lead you in creating a city, state dashboard much like we did with last week’s tutorial: Your Church’s Zip Code Dashboard.

It’s important, in my humble opinion, for a church to understand the dynamics and demographics of their church to be able to serve and reach their church and, more importantly, the surrounding cities and communities.

And if you church’s pulse is community group like ours is, then these dashboard reports are going to help you identify and anticipate where groups need to be launched.

Yes, preventative action and forecasting the growth of your church based on your current data.

Second to God providing your church wisdom and discernment for where to cast nets, if data is coupled with your city and surrounding areas’ population growth (by zip code or city), then you really can see where your church is reaching and should reach.

I think you get the point.  Enough talk, and let’s get started with today’s tutorial.

Copy, Paste and Modify Previous Tutorial

First, I’m not getting deep into details in this tutorial.

If you get a bit lost, then you’ll want to review last week’s tutorial for greater insight and detail.

Open a preferred text editor, creating and saving a file named zipcode-city-dashboard.php.

As usual, don’t forget to include the necessary comments and file inclusions as performed in previous tutorials.

Now, copy and paste last week’s tutorial code into the file, and we’re ready to modify the code.

Find the peopleQry variable in your code.  We’re going to modify this line of MySQL code to retrieve the city, state and total from you ccb_profile_data table, grouping the data by city and state, and in descending order.

Rewrite the previous sentence, transforming it from MySQL written english into MySQL syntax.  The rewrite of MySQL syntax should look like the code below.

Next, you’re ready to modify the text value of the reportData variable.  Change the text of the reportData variable to be the following:

Next, it’s time to change the values of the locationData variable.  Instead of zip code, we need to change the locationData variable to return the city and state.

Don’t forget to change the next line of code, the if statement, to check for empty city and not zip code value.

That’s it.  Those are all the changes needed to be made to view a CCB dashboard breakdown of where your church attendees and members live.

Save and test your code

The following is what your code should look like in its entirety.

Save the file, and execute and view it via a web browser.  You should see a city breakdown for your church (see image below).


Also, make note of the “No Address” sections or allocations.  This may mean that you have CCB profiles that don’t have their address listed or associated with their profile.

For instance, if your church does an annual mailing or event mailings, then those who don’t receive the mailed message  might not have an address specified.

Your church may want to take a moment to execute a communications campaign to ensure CCB profile address information is entered and/or up to date.

A good rule of thumb would be to do this once or twice a year, depending on the growth of your church.

Well, that’s it for this tutorial series.  I’ll see you next week with a new tutorial.

Please comment if this tutorial has helped you.