What’s better for newbies to learn first PHP or MySQL?

It’s a good question for newbies to have, where to start? What comes first PHP or MySQL?  The chicken or the egg? You can learn both independently, but if you have no experience with either, I think it’s best to start with PHP.   Pretty quickly as you work through tutorials you will encounter MySQL. […]

If you are using file_get_contents you might want to check out PHP Simple HTML DOM Parser

PHP Simple HTML DOM Parser is a great tool to process HTML from remote sites.  The HTML is returned from the library. So that you can then search and iterate through it, this is great for scraping sites.  I didn’t write the code, but you can download it here and find some simple documentation: http://simplehtmldom.sourceforge.net/ […]

New to PHP and need some help with errors?

Wondering what’s going on with your variables? Not seeing what you are expecting? If you are a newbie learning PHP, one of the most useful functions to know is var_dump(). It dumps the contents of a variable, so you can see it in your web browser, it’s simple to use for example: var_dump($my_variable); Then you […]

How to join three MySQL database tables together in a simple SELECT statement

Following on from my post of how to join two MySQL tables together, adding a third table is just as easy, but if you need an example this one extends the previous post by adding a third table. For example I have a table of products, table of product categories and table of product suppliers, […]

Still using the old MySQL driver? What you need to know about MySQLi…

Its time to upgrade from the PHP MySQL extension The PHP MySQL extension was deprecated in PHP 5.5.0! You should upgrade your code to use MySQLi at least, even better would be upgrading to PDO. This post about selecting data uses PDO and has the full source code available for you. But back to MySQLi […]

How to use Google Charts together with PHP

If you are looking to add charts to your PHP pages and haven’t already checked out Google Charts, I recommend you do, I’ve used them in a number of projects to great effect. Features & Benefits: They are free HTML5 / SVG  based for cross-browser compatibility Well documented Lots of examples in the Chart Gallery, […]

4 Free PHP PDF Libraries you can use to convert HTML to PDF

Use any of these 4 libraries below to easily covert your HTML to PDF files with PHP. I’ve always used TCPDF for converting HTML, including JPEG and SVG images into PDF files, which you can download inline in the browser, save on the server or force a “save as” dialog. Free PDF – http://www.fpdf.org/ TCPDF – http://www.tcpdf.org/ […]

How to join two MySQL database tables together in a simple SELECT statement

How to join two MySQL database tables together in a simple SELECT statement? For example I have a table of products and a table of product categories, how to return the category description of each product? Products ———– id category_id product_name Categories ————- id description A. In it’s simplest form you would join two tables […]

How do you include frequently used code in another PHP file?

Q. How do you include PHP files in other PHP files? – Useful for including your database connection across all pages that need it. – If you have written some functions once and want to reference them in other pages. – Also commonly used to keep consistent header and footer parts of your pages, by […]