search
top
Currently Browsing: Code Samples

How I built ‘BoatRampDirectory.com’ using PHP, mySQL, and Google maps

Are you looking to integrate Google Maps into your site?  I found an article on the Google Developer site titled ‘Creating a Store Locator with PHP, MySQL & Google Maps’.   Well, I don’t have any stores, but I loved the idea.  So I took the concepts in the article and built BoatRampDirectory.com The idea is that you input a zip code or the name of a city and state, and the app... read more

Using the PHP Switch Statement

The switch statement is similar to a series of IF statements on the same expression. In many occasions, you may want to compare the same variable (or expression) with many different values, and execute a different piece of code depending on which value it equals to. This is  what the switch statement is for. <?php switch ($make) { case "Ford": echo "Your car is a... read more

Variables – Good Form

This is a small example of the ‘good’ form of variable naming.  What’s good about it is the fact when you read the code:   echo “This $brand $model is a $year <br>”;  it is fairly easy to guess which variable is which.  Contrast this with the ‘bad form’ variables, which is much harder to... read more

Variables – Bad Form

This is a small example of the ‘bad’ form of variable naming.  What’s bad about it is the fact when you read the code:   echo “This $a $b is a $c <br>“;  it is all but impossible to guess which variable is which.  Contrast this with the ‘good form’ variables, which is much easier to... read more

top