Have you ever written a piece of code that works, but the amount of redundancy and inefficiency drove you nuts? Always had the itch to go back and pretty it up? Well, that’s exactly what I did. I recently wrote a script for a people directory, it contained 3 parts
- An database storing the information of the people (i.e. name, states, country, etc etc.)
- the html input file (see example below)
- The data processor using PHP
input file (input.html)
The idea is that you will be able to select a last name or a state and find the corresponding results. For example, finding someone in the state of Virginia, finding someone with last name start with W, or a combination of both.
This was the first attempt for selecting the matching last name:
HERE
HERE
By using arrays, here are the code for selecting the matching last name and state and generate the SQL query
HERE
HERE
Chang is a 20 some years old web technology enthusiast, he loves open source web application design and development. In his spare times, he loves to explore new technologies, web 2.0 and its business implications,