Best Book to Learn PHP/MySQL Programming

| 2 Comments

My foray into the world of programming continues with PHP. Several readers wrote to recommend a book. All suggested the same title (by Luke & Laura). One even offered to send his used copy.

PHPEasy to see why they like it so much. The reading flows. Being the 4th edition, the editors had plenty of time to polish the text. It's enjoyable to read a well written book.

If you search Amazon Books for the query » 'php mysql,' this is the title that tops the (long) list returned. Published by Addison-Wesley, who have a reputation for releasing quality titles.

The book, as you might expect, goes into more detail than the video tutorial I was watching. Now that I have a feel for the language, these details are falling into place.

For example, they introduce & discuss the object model in Part I (chapter 6). Object-oriented programming (OOP) supposedly represents a new way of thinking, which differs from the old 'procedural' method.

I especially like how they point out 'common mistakes' (.. cuz I make them all).

Every reference I've ever read on the subject of PHP (including this book) always begins by noting how PHP allows you to serve DYNAMIC web pages (*.php), as opposed to 'static' pages (*.html), which don't change (.. unless you change them yourself).

PHP allows you to craft pages that change according to virtually any criteria you can imagine .. which is what makes it so powerful and useful. The book puts it this way:

If you've built websites using plain HTML, you realize the limitations of this approach. Static content from a pure HTML website is just that--static. It stays the same unless you physically update it. Your users can't interact with the site in any meaningful fashion. Using a language such as PHP and a database such as MySQL allows you to make your sites dynamic: to have them be customizable and contain real-time information.

MySQL databaseBut the fact remains that web authors still need to generate quality content. No matter how you might happen to retrieve & arrange & display the data stored in your database, the content is only as good as what goes INTO your database.

No amount of programming wizardry will turn krappy, poorly written content into a silk purse. (Wouldn't it be great if it could?) That's the thing staring me in the face, sobering my lofty techno esthusiasm.

••• today's entry continues here below •••

I really enjoy learning the lingo of programming. For example, a function inside an object is called a method. I like being able to read a text full of geeky jargon and actually understand what it's trying to say. I like being able to communicate with programmers and craft an intelligent question.

The most prominent aspect of this book is how the authors focus on learning the language to perform REAL-WORLD applications (.. even in the introductory chapters), and not simply explain how the language works.

One guy (Richard) said he read it in "somethng like 3 days." (The book is 1,000 pages.) He grew up in Scotland, before moving to Silicon Valley.

The only potential downside I could see was where it said:

This book is aimed at readers who already know at least the basics of HTML and have done some programming in a modern programming language before but have not necessarily programmed for the Internet or used a relational database. If you are a beginning programmer, you should still find this book useful, but digesting it might take a little longer. We've tried not to leave out any basic concepts, but we do cover them at speed.

But this is what helps the text move along at a nice clip. They explain basic concepts; they just don't labor them. If I need more background on a particular topic, there's always Google.

PHP and MySQL Web Development by Luke + LauraWhile reading, I even learned that my laptop has a key I never noticed before. Can you believe that? I've been starring at this keyboard for years and never noticed a character.

It's called the 'backtick' (`), located on the same key as the tilde (« which I use as shorthand for 'about' or 'roughly' .. as in » "the Rad community forums contain ~ 50K posts"). I thought, No way is there a character I haven't noticed.

PHP uses these 'backticks' in pairs in what's called the 'execution operator,' which executes the code placed between them at your server's command line .. as in:

$server_output = `ls -la`;
echo '<pre>'.$server_output.'</pre>';

I learned how to use the Unix/Linux command line last summer, so I'm familiar with the power available at the shell. (Also works with Windows servers.)

Lastly I learned that the difference between a programming language that's weakly-typed (such as PHP) and one that's strongly-typed (such as C#) has nothing to do with how hard you bang the keyboard. =)

In other news, the boyz at YaBB released a special '10th anniversary edition' of their forum script (written in Perl), which I installed » here. (That link will go away after the upgrade is complete.)

Before switching over I need to wait until they patch the mods I use so they work with the new version. Radified has been using YaBB since June, 2001. Think we have ~ 50K posts in 5,000 separate threads.

For more along these lines, here's a Google search preconfigured for the query » best book to learn php mysql programming

2 Comments

> That's the thing staring me in the face, sobering my lofty techno esthusiasm.

I seem to recall we've discussed this before, but the main thing to do is, well, to DO. Write, code, whatever, and if you want to pursue Quality follow up the doing by iterating between analysing what you did and trying do DO something else and applying what you learned.

> Object-oriented programming (OOP) supposedly represents a new way of thinking, which differs from the old 'procedural' method.

You're absolutely right to say "supposedly", because it's not really that new, as such, and it's not really a big difference in thinking.

Code (active) and data (passive) are the fundamental elements of the computer universe; the thing is that the difference between them is not as absolute as that as between, say, protons and electrons.

Now, lots of programming languages have always treated them as very distinct things, to the point where it became the dominant way of looking at things by the early 60's. Indeed, much of the idea of "data types" comes from the languages which had this separation. Data was data, types described categories of data, and code was code but used types to check for accuracy.

OOP (from ~1967) tried to undo the separation a little bit; data is still data, and types are still types, but by attaching the code *to* the data types we get something more useful. Code is, in this model, subordinate to type, and the argument about the "thinking" resulting is that programs are mostly models of real-world things (so that a data type in a program represents a kind of thing in the real world). OOP arose from work on simulation in the language Simula-67, but the modelling aspect of this influenced legions of business programmers (whose jobs often consisted of transliterating real-world activities into computer equivalents) for whom this was a natural fit.

However, Lisp (which predates all of this) also didn't really separate code and data. Code and data share the same basic syntax, there isn't a large type barrier between them, and Lisp could bundle groups of data together in the same way as "types" using a stylistic coding idea called a closure.

Now, closures and OOP pretty much do the same thing (in fact, they are duals; mirror images of each other). One puts data (or types) first and code subordinate to that, and the other puts code at the top of the heap.

So, OOP isn't that new, and the cognitive benefits of it really only apply when you're trying to construct models of real-world things or processes (which is what much programming is, but not all). Which does make it useful, but it's not all that; it seems more dramatic as a concept because it's so easy for people as they learn to internalize the separation between code and data as being complete, and breaking down an assumption like that is a powerful feeling (which folks then tend to assume are due to OOP itself).


About this Entry

This page contains a single entry by Rad published on July 14, 2010 7:14 AM.

What Drives a Handsome Doctor (like Che Guevara) to Become a Militant Revolutionary? was the previous entry in this blog.

Cold Turkey & Rad Movies is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.