Welcome, Guest | Sign In

Submit - Cancel

Katie and I at Mulligan

It's no secret - I really like Mulligan Plains. This remote section of Marquette County is off the beaten path and contains many hiking adventures, including waterfalls, cliffs, and lakes. So when Katie and I headed up north on a cool fall day before hunting season I made it a point to take her to Mulligan and show her one of my favorite Upper Peninsula destinations.

Even though we slept in at the Ishpeming hotel quite a bit, we managed to make it to the creek before noon. The easiest place to visit at Mulligan are the falls north of Silver Lake Basin, so we took the county roads up along the western edge of the plains and parked at the foot bridge over Mulligan Creek. Faith and I had visited this area a year ago and had taken a convoluted route to the falls that involved crossing the creek over a beaver dam and bushwhacking through some terribly thick pine trees. A four-wheeler had given us this route before, but I didn't want to follow it today.

Katie and I crossed the narrow, shaky bridge over the creek and headed up the narrow two-track. Instead of cutting across the creek, like I did last time, we cut off the trail (which bends northwards) and continued along the side of the creek. The trees weren't thick on this side of the creek, but we did have to go up...

read more »

Intro to SQL Part D

For the last post in this short series on SQL I wanted to explain some more in-depth usage. A technique that I wish I would have started using in my early websites is a centralized script to handle all of my database calls. PHP does have some great functions built in to connect, read, and write using SQL statements (check out mysqli), but it's easy to start copying the same eight to ten lines of code every time you want a piece of data from your tables. A better approach is to handle the queries with a centralized class.

Before anything can be read or written to a table with a SQL statement, you need to create a connection. Your website will be signing as a user with specific privileges. A good technique is to make two users, one that can read and one that can read and write. By using the former user as much as possible and taking extra care with the latter one, you will minimize the possibility of hackers uploading malicious information or dropping whole tables.

Once a connection is made you can start having fun with the database class, customizing the methods as much as necessary to integrate it easily with your site. I prefer returning my information as arrays of objects or single objects, so I have two separate methods in my class.

read more »

Intro to SQL Part C

While the last two posts focused heavily on theory and fundamentals of SQL it's time to start on the actual usage. There's a ton of good tutorials out there that skip right to the code, but as a young developer, I wasn't convinced that SQL was a worthwhile tool until I was forced to use it. I wanted to spend a good amount of time discussing the basics before jumping into some examples. If you're looking for more advanced and specific uses, I'd highly recommend checking out w3schools SQL tutorials.

As I introduced in my last post, an SQL table is a collection of unique rows. There are two primary things that you do with the data in a table - read and write. With the proper syntax, a hacker can write to your database, injecting into or deleting your data, so it's important to restrict the front end privileges and validate. That's a subject for a later post, though. Let's look at how you can read a table.

Reading from a table is also known as a 'select' statement, since you're selecting entire rows of information. You can restrict how many rows you select, pulling single rows or entire tables, and you can also restrict what fields you select out of the rows. A select statement has several important...

read more »

Intro to SQL Part B

In my last post, I introduced some of the basic ideas of data storage and how I came to realize that SQL would be a great solution to my content handling problems. Now I'd like to walk through some of the more advanced concepts and start going through some basic uses. There's plenty of great tutorials out there if you'd like to take SQL to the next level (I'd recommend checking out w3schools), but I hope these posts make a great foundation for a starting developer.

An Excel workbook is a good way to picture a SQL database. A database is a collection of tables (one table per tab), with each table showing a different portion of the total content. Each table should be unique in most cases to avoid duplicating your data. The individual tables in the database have some constraints. Rows must have the same number of columns and identical column types. It's also a good idea to keep the columns simple. If you're saving numbers, then the column should be set to save numbers.

The last paragraph may be hard to understand at first, so here's another example. This blog is being saved in a SQL database. One table is saving all of the posts, with each row in the table relating...

read more »

Intro to SQL Part A

I like to think of myself as a practical web developer. With no true formal training, most of what I use to make my web sites is self-taught. Instead of trying to apply what I learned in a classroom into an online project, I went out and learned what I needed to get a project done. This allowed me to enter the world of web programming slowly, gradually picking up additional techniques and languages as my web sites became more advanced. There has been more than once that this approach has made my life difficult, though, and SQL is one of the more blatant examples.

After I learned xHTML and CSS, I thought that I was set with web development. I could design and launch fully compliant sites, updating them as necessary with new content. Once a few months passed, though, I started to realize that there was a big difference between markup and content, and that the content (data) of a web site should be handled separately from the markup (html tags). By keeping my changing content hard-coded on the page, I was losing my old data and funneling all of the updates through a single person, myself, who knew how to write markup.

I started looking at alternate methods of saving my dynamic content over the next year, using both xml and text files to save the data. With a static...

read more »