PHP and MySQL
I haven't posted anything for a while because I've been taking a short break from Cinema 4D and working on a website which needed to use a database. This meant using PHP and MySQL, which meant refreshing (well, rather more like relearning) how to use these technologies. I hadn't used PHP to any extent for some years and my previous work with web databases was a long time ago and used the classic Active Server Pages (remember them?) and an Access database!
So I had some catching-up to do and wanted a book to help do it. There are, of course, many tutorials on the web but in my experience nothing beats having a book open next to your keyboard. Fortunately I found a book which did everything I needed: 'PHP & MYSQL: server -side web development' by Jon Duckett.
This is a really good book. It starts with the most basic stuff such as installing XAMPP so you have a server to test PHP pages on, then onto PHP itself with everything from basic data types up to more advanced topics such as getting data from forms, using cookies and error handling. Then the rest of the book (just under half of it) focusses on using PHP with MySQL databases, which is what I was most looking for. There are plenty of screenshots and lots of code samples, all thoroughly explained and all of which can be downloaded to save you typing it all in.
With this book's help I completed the work I needed to do. It's not perfect of course. For one, thing, don't buy this thinking it's a reference book. It's really a very, very long tutorial - much longer than anything you could find on the web. You will still need a reference, such as the excellent online PHP manual and the latest MySQL manual. Comprehensive though it is, there are still points I needed to solve which weren't covered. For example, it shows how to access phpMyAdmin for creating and managing databases, but doesn't show how to use it. I guess there was a limit to what could be included in an already large book (668 pages including the index). Having said that, phpMyAdmin is really easy to use and there is always the documentation on its dedicated website. Another issue which I specifically wanted help on was how to store date values into the database and read them back again. It sounds so basic, but there are several formats for dates in PHP which left me a little confused as to what the database actually stored. How to add date values to a database didn't seem to be covered, though in such a large book I may simply have missed it. A bit of online searching resolved the issue.
The book is not overly expensive considering its size and the amount of work which has clearly gone into it. I got my copy from Amazon (UK site link here) and at the time of writing it costs about £25 (approx. $32 or 30 euro). It's well worth it if you need to write PHP and/or use online databases.
I'm really taken with PHP having got to know it again. I'm thinking of converting this site to use PHP throughout when I drop the use of Adobe Dreamweaver early next year (when my subscription expires). Until now I've used Dreamweaver templates to create pages for the sites I write, but I could use PHP to do something similar by including standard layouts held in separate files. This would considerably reduce the amount of code for each page because Dreamweaver templates include all the code present in the template in every page written with them, whereas a template file added in with a PHP include instruction doesn't reproduce that code in every single page - it's just included when the page is requested.
But that's for the future. In the meantime, if you are considering using PHP with or without MySQL then I can thoroughly recommend this book.
Page last updated December 19th 2024