Entries tagged "database"

Lessons Learned: Automated Script for Populating Meeting Handouts Database

A few years back, I developed a script for processing sets of PDFs to populate a database. That database is then used to dynamically generate the corresponding meeting handouts page for visitors to download the PDFs. The project was planned out so that pretty much everything needed for the meeting handouts page could be found in the set of PDFs. The only other extra thing I needed to do, besides making occasional minor corrections to the database, was store these handouts in a folder that was named with the meeting date, which I was already doing. Then I just needed to upload the files to the server and run the script. [Continue reading]

Add Delay Feature to Newsfeed

The newsfeed feature I developed a few years back works as expected. At times, however, I wish it would let me have a post automatically appear after a specific time. Especially now that I'm used to services like HootSuite that allow me to schedule tweets and other social media postings. [Continue reading]

Use MySQL’s Date Functions Instead of PHP’s

Many of the MySQL queries that I create include a date and / or time. My usual place to get this information was from PHP's date() function. At least until I discovered that MySQL has many built-in functions to do the same thing. Let's look at a quick example. [Continue reading]

Import Login Information for Database Connection Scripts

I'm starting to realize that importing the script used to establish a database connections isn't enough. Being able to import a script wherever the database is needed does simplify the process of changing a database password since it only needs to be changed in one place. However, I keep finding reasons to make major revisions to the connection script which usually results in having multiple versions and I don't always have the time to complete the upgrade process. All of those connection scripts need to be updated when the password changes. [Continue reading]

Calculate Distance Between Zip Codes Part 2: Build the Search Engine

With a database full of zip codes, latitudes, and longitudes, you can get all the entries that are within a given radius using the Haversine formula…and a little help from Google. This week's post will build on the work done last time by developing a search engine where users can enter a zip code and a search radius. The script will then output all the records within the given radius. [Continue reading]

Calculate Distance Between Zip Codes Part 1: Geocode Database Entries with the Google Maps API

A few years back I looked into using the Google Maps API to calculate the distance between two zip codes. The proof of concept seemed to work well enough. But when I attempted to perform larger-scale calculations, the solution began falling apart. And it was slow… So I needed to develop an alternative solution. [Continue reading]

Lessons Learned: Management Program for the Plan Preparations Guide

Several years back, I developed one of my first in-depth PHP scripts. The goal was to create a voting mechanism for a set of notes posted online. The vote helped committee members decide on whether specific notes should be removed, moved, or changed. Although the completed solution wasn't perfect, it was an excellent learning experience. So I wanted to share a few things I learned. [Continue reading]

Alternate Way to Write PHP Function Arguments Part 2: Using Associative Arrays

The standard process for building user-defined functions is to manually list out the arguments. The problem with this method is that the arguments need to appear in the order given. If the function has several optional arguments, you need to pass a value for all arguments just to specify the last one. Well, let's look at an alternate way to write functions which provides more freedom. [Continue reading]

Alternate Way to Write PHP Function Arguments Part 1: The Standard Process

When calling user-defined functions, there are occasions where it feels like optional arguments become required. I've seen third-party solutions like WordPress find a way to get around this issue. But it wasn't until recently that I've attempted my own solution. Before getting into an alternate method of passing function arguments, however, let's look at the standard process. [Continue reading]

Check Your Error 404 Database for Broken Links with cURL

Some websites that I maintain have a database for tracking which pages have moved. The problem is that some of the links that indicate where a page has moved to break. So I end up with a 404 error saying a page has moved. When the visitor goes to the new page, they are greeted with another 404 error saying the page has moved. So let's look into writing a script to look through the database for broken links. [Continue reading]