Current project: Sci-fi rules for D&D 4th Edition, Writing

New Lens on Squidoo – PHP Tutorial

Well, that was fun. I wouldn’t say I’d mastered PHP yet, by far, but now I’ve got a fair idea of its capabilities and a good collection of stock code snippets to play with. Now that I’ve spent months crawling the web for some tips on building a website with PHP, I’ve decided to put together the PHP tutorial I wished I’d had at the beginning. I’ve skipped over the bare basics in favor of explaining each line of code one piece at a time, and tried to write with the assumption that the reader doesn’t have a background in programming beside html itself. (I think I might have to build an html and css tutorial later – it was fun).

The tutorial covers all the topics I thought were vital to my website project. I started out with a basic run-through of what PHP can do and what you have to know/have before you can use it. Then I went right in to the meat and potatoes, but in the order I wish I’d learned it, rather than in the order I did. I started with using includes – writing part of your page code in a separate file for ease of editing later – then moved on the the tough stuff – databases. Admittedly, I have no idea how any of the other databases might differ from MySQL, but since that’s not what the tutorial is about, anyone using a different one will have to debug things on their own (what better way to learn, after all!)

I focused a good bit of time on the part that took me the longest to get working – that is, generating dynamic URLs with a query string. I completely skipped the ‘try this example’ stuff – there’s plenty of those on w3schools, and they didn’t really help me. Instead I used an approach I learned in one of my textbooks – explaining lines of code one piece at a time with helpful examples and a personal style. I’ve also included real working examples of code and suggestions for what uses to put them to. The goal is to get the reader from knowing nothing to understanding PHP in 4,000 words or fewer. I’d appreciate any feedback, either here in the comments or on the lens itself (backlinks welcome – one per comment please) from anyone interested in PHP on how well it accomplishes this goal.

As a little extra tidbit, I’ve included some tips on converting dynamic URLs to static ones. There seem to be several different methods out there, many of them far too complicated for a beginner to try, so I snagged a pair of the better ones and did a little how-to for ‘dessert’. Enjoy!