75 PHP & MySQL tips, tutorials, techniques & resources
Revolver: Fast Image Rotation Engine
"Revolver can be used as a clean, simple way to showcase a design portfolio, sketchbook, photoblog, or simple image gallery. Uses abound. Be creative, invent your own."
Smarty - a PHP template engine
"If you're working in a team where designers work close to the programmers than Smarty is the perfect solution in order to separate the content from presentation. The designer will have a way more easier job finding exactly what they want to change and customize while the programmer will have it's own space of work, away from the unexperienced."
Tutorials Round-Up: Ajax, CSS, PHP and More
"You don’t have to re-invent the wheel all the time - you can use existing solutions, modify and improve them and publish them as well - just the way other people did it for you. In this post we’ve covered over 200 Ajax, CSS, Flash, JavaScript, PHP, MySQL, RSS, XML as well as ASP, C++, Perl, Python and Java tutorials."
PHP and XML Sitting in a Tree
"There is often no right way to store and serve your data, and practically speaking, the best route to choose is often the one you know best. However, PHP5 has brought with it a new function, SimpleXML, which can help offer you even more options, and is a powerful addition to your scripting toolbox."
Variable Scope for New Programmers
"I routinely see new programmers running into trouble with the concept of variable scope. It’s an extremely important concept, however, and one that must be understood in order to develop a reliable application. If you work in multiple programming languages, it can get even more confusing—each language has its own set of rules about how variable scope is handled."
Being a PHP Lumberjack
"I know people who spend hours beating their heads against this wall, tweaking their code to within an inch of its life and distorting it blindly in hopes of solving it by brute force. There are better ways to hunt down logical errors in your code. I’d like to focus on a more generalized practice that can help you watch your code’s execution. Get out your double-bladed axe—we’re going logging."
Easy-peasy PHP
"So while I am no PHP expert, the purpose of this article is to introduce a few simple techniques that Web developers new to server-side scripting should be able to learn and adapt for their own uses without too much hair pulling."
PHPitfalls: Five Beginner Mistakes to Avoid
"My perusal of various developer forums has helped me spot several trends in beginner mistakes, and I’ll address some of the most common problems I’ve run across while sifting through nearly incomprehensible forum postings in search of beginners in distress."
Objectifying JavaScript
"When I first began programming with JavaScript, I created my variables and then encapsulated any functionality I needed to reuse into a function. As my tasks got more complicated and as I started learning object-oriented programming in other languages, I began to see the benefits of applying that to JavaScript."
Generating Dynamic CSS with PHP
"I will design a mock up of a basic site layout using CSS. It will include a masthead, menu and content area. I will then assign three color schemes using PHP for the background and foreground colors of each element in the layout and show you how you can easily switch between each one or add new schemes—all from one script. I’ll conclude the article by suggesting ways you can extend or improve on these ideas for your own site."
How to e-mail a HTML form with PHP
"HTML forms are easy to make, but sending a form as an e-mail is a lot harder. There are many ways to do this, but I only review one in this article. HTML combined with a little PHP scripting."
Dynamic Bread Crumbs
"For a redesign project at work, the new design called for bread crumbs. In my opinion, bread crumbs are a great thing to add to a site, and others agree. I didn’t want to have to specify anything on each page for the bread crumbs to work, so I wanted to do it all dynamically."
Creating a Dynamic Google Sitemap
"By doing some quick queries, you can generate a sitemap for Google that has all of your blog entries in it."
PHP Get Age Function
"Such things like copyright dates, ages, etc. can cause problems on websites unless they are dynamic. For example, I have my age in the little about me blurb in the sidebar. I made a little function to calculate my age so that I don’t have to go in every year on my birthday and add another year to my age."
Object-oriented programming
"Paul Hudson takes the blood, sweat and tears out of mastering object-oriented programming, a powerful technique that’s otherwise known as OOP."
Smart Image Resizer
"A ridiculously easy-to-use PHP script for resizing images the smart way."
Mediatyping
"Just prior to jetting off to Austin last week, I started playing around with a mobile version of this site. While a personal blog is hardly a site that really needs one (unlike, say, an app with a proven mobile user-base like Twitter), I wanted to see what would be involved in re-factoring this design into something more fitting for a mobile environment."
Designer PHP: A Dynamic Menu with If and Else
"In this article, we’ll include one file for main navigation, but make individual menu items “live” depending on the page they appear on."
Designer PHP: A Simple Include
"Years ago I was introduced to PHP. Since then, using simple PHP includes has saved me huge amounts of time in revising and editing HTML, so I thought I’d share some basic tips and hopefully save you some time, too."
PHP components: Autosuggest
"After several requests I published this simple "PHP component", ready to use, to implement a search form with an autosuggest feature using PHP and MySQL."
List of Image Cropping Scripts
"After looking for awhile for a script that will crop your image in the browser I decided to put a list together. I found various types of scripts that will accomplish this. The list below is a list of image cropping scripts."
Organizing Images with a Database
"It’s key to understand that metadata for each image is more important than storage location (directory), because the image files hold no meaning. The challenge is finding a simple and effective way to relate the images in FTP folders, with the associated image information in the database."
Introduction to Databases
"A database is simply a bunch of information (data) stored on a computer. This could be a list of all your clients, a list of the products you sell, the results of a chess tournament or everyone in your family tree."
PHP For Designers
"Writing code is not very different from writing prose or poetry, it’s just a different medium and audience."
Smarter Image Hotlinking Prevention
"Most web professionals are all too aware of the problems caused by hotlinkers. Leechers. Bandwidth thieves. People who use images hosted on your web server on their own pages. With PHP and mod_rewrite, you can disallow embedding and allow linking while automatically creating gallery pages for those direct linkers."
A Better Image Rotator
"The first image rotator made it easy to generate a random image on a web page, even if you had never worked with PHP before. The new, more powerful (but still dead easy) version uses a simple configuration file to create custom links, alt tags, titles, and even CSS styles for each image. Plus it handles differently sized images without a hiccup. Enjoy!"
Keeping Navigation Current With PHP
"Turning unordered lists into elegant navigational menus has become a new favorite pastime for many web designers. A dash of PHP can add intelligence to your CSS-styled menu."
Random Image Rotation
"Readers return to sites that appear fresh and new on each visit. On a news site, magazine, or blog, stories or headlines will be updated frequently. But how can static sites keep that fresh feeling? Dan Benjamin’s free image randomizer may do the trick, and you needn’t be a programmer to install it."
Win the SPAM Arms Race
"SPAM is evil, moronic, and pervasive, but help is on the way. All it takes is a bit of JavaScript, a smidgen of PHP, and the ten minutes it takes to read this short, sweet tutorial. Reduce dreck mail with Dan Benjamin’s easy-to-implement address encoder."
Dynamically Conjuring Drop-Down Navigation
"Got content? Got pages and pages of content? Wouldn’t it be nice if you could offer your readers a drop-down menu providing instant access to any page, without having to sit down and program the darned thing? By marrying a seemingly forgotten XHTML element to simple, drop-in JavaScript, Christian Heilmann shows how to do just that. There’s even a PHP backup for those whose browsers lack access to JavaScript. Turn on, tune in, drop-down."
Build a PHP Switcher
"ALA’s open source style sheet switchers are swell as long as your visitors use compliant browsers and have JavaScript turned on. But what if they don’t? Perhaps, this: Chris Clark tells how to build a cross-browser, backward-compatible, forward-compatible, standards-compliant style sheet switcher in just five lines of code."
Manage Your Content With PHP
"XHTML for structured markup. CSS for presentation. What more could you ask? How about an easy way to manage your site, using free, open-source tools? Christopher Robbins shows how to use PHP to build an intro-level, template-driven system that handles site maintenance chores and remembers your visitors’ preferences."
Time-Savers: Code Beautifier And Formatter
"The tools and services we've collected below aren't validators. They format and beautify the code; some of them can remove redundant elements. Using them, you have to make sure you have a backup, so your data can always be restored."
Quick Calendar Using AJAX and PHP
"We need to create a calendar that can plug itself into any system seamlessly without problems. Whether we are using Wordpress, Mambo/Joomla or Drupal, we should only need to insert one line into our code for the calendar to work. ie something like this..."
Developing PHP the AJAX way
"Asynchronous JavaScript and XML (Ajax), is arguably the most popular new Web technology. In this two-part "Developing PHP the Ajax way" series, you will create a simple photo album as an online Web application, entirely in PHP and the Simple Ajax Toolkit (Sajax)."
Creating Sortable Lists With PHP And Ajax
"You might have been in a situation before where you had a list of items in your database that needed to be output in a specific order. This article covers the implementation of a system that lets you easily define the order of such a list."
Creating a MySQL connection with PHP/AJAX
"In this tutorial I will explain how to open a mysql database connection using PHP and the all popular AJAX. The purpose of this article is to demonstrate how the XMLHttpRequest object works within php and the advantages of using it."
Building a Bulletproof Contact Form with PHP
"In the early years of operating a website, we were happy to put our shiny new email address out there for anyone to mailto, but the rise of the spammer has made us justifiably wary of publicizing our contact details—enter the contact form."
SELECT Statements Tutorial
"This Intermediate/Advanced SQL Tutorial will cover the SELECT statement in great detail. The SELECT statement is the core of SQL, and it is likely that the vast majority of your SQL commands will be SELECT statements. Due to the enormous amount of options available for the SELECT statement, this entire tutorial has been dedicated to it."
Using MySQL
"A series of MySQL workshops designed to introduce MySQL and SQL statements to a novice developer."
Backing Up/Restoring MySQL Databases
"It's better for you to be prepared, and this tutorial will provide you with the information you need to protect your data!"
Loading a Random Image with PHP
"If you have a site containing a splash image, you may want to consider displaying a different image each time a visitor visits your site. You can accomplish that by loading a random image using PHP."
Relational Database Design
"This tutorial teaches the basics of relational database design. Along the way, SQL tips and best practices will also be shown and explained. In addition, you will be introduced to important database terminology."
Using Includes with PHP
"This tutorial is just a down and dirty explanation on how to use the include() function in an attempt to make your PHP code-writing life a little easier."
Introduction to PHP
"Unlike other languages, PHP does not require rigorous training and a long time of practice before you can create anything useful or publically displayable. In fact, by the end of this tutorial, you will have created a web page that displays some text from a PHP script!"
PHP Contact Form
"Contact forms are a great way to enable visitors to your site to contact you. In this tutorial, I will explain how to create a contact form using HTML and PHP."
Getting to Grips with mySQL
"This tutorial will show you how to create and query a database using SQL and the mySQL command terminal."
PHP and the UNIX Timestamp
"By the end of this guide you will - hopefully - have an understanding of the Unix timestamp that allows you a powerful form of managing your PHP applications."
File Handling in PHP
"When writing applications for the web, it's often important to be able to save data. One way to do this is by writing data to a file."
Introduction to OOP using PHP
"This tutorial is an introduction to object oriented programming (OOP) with PHP. Upon finishing this tutorial, you should have the basic tools necessary to begin navigating the world of OOP."
PHP Basics
"PHP is a programming language that's designed specifically for building Websites, and is both blessed and cursed with being remarkably easy to learn and use."
Watermark Images on the Fly in PHP
"The standard watermarking procedure of editing the image in a photo-editing application is time consuming. PHP offers a far better solution."
Build your own Database Driven Website using PHP & MySQL
"Over the course of these tutorials, it will be my job to guide you as you take your first steps beyond the HTML world of client-side site design."
Build a PHP Multiple Picture Showcase Using PHP and HTML
"I needed a row of five thumbnail images of my products, randomly displayed. I thought it would be easy to find this PHP code, but this turned out not to be the case, so I rolled up my sleeves and wrote my own."
Toughen Forms' Security with an Image
"In this article, I'll guide you through the basics of creating and integrating a security image like those found on the sign-up pages of many mainstream sites."
Top 7 PHP Security Blunders
"Many of PHP's features can lead a programmer inadvertently to allow security holes to creep into a Web application. However, PHP can be as secure as any other language once you understand the basic types of flaws PHP applications tend to exhibit."
Create Dynamic Images with ImageMagick
"Imagine the possibilities that would open up if you could make your web site change the appearance of the images it displayed, based upon input from you, or any other authorized site visitor."
The CakePHP Framework: Your First Bite
"Cake is based on an MVC-like architecture that is both powerful and easy to grasp: controllers, models and views guarantee a strict but natural separation of business logic from data and presentation layers."
Build a Photo Gallery Using CakePHP and Flickr
"In this article, we'll use the Flickr API and CakePHP to take the images we've loaded onto Flickr and use them to build our own, non-Flickr web gallery."
Learn symfony: a Beginner's Tutorial
"Stable, fully documented, and released under the open-source MIT license, the symfony framework is used by hundreds of web sites, including some very large ones."
Developing with the Facebook Platform and PHP
"If you could tap into the Facebook userbase, you could very easily and quickly increase the audience's awareness of your brand, product, service, or web site."
Whip Up a Yahoo! Mashup Using PHP
"Mashups -- web applications that grab information from different external sources and mix it together in new and exciting ways -- are fun to build, popular with users, and oh-so-very Web 2.0."
Cache it! Solve PHP Performance Problems
"Looking for ways to speed up your web site? Caching's the answer. Whether you want to ensure your content's cached, or guarantee that it's not, this tutorial has the solutions to your caching problems."
Perfect PHP Pagination
"In this practical tute, Lyndon steps through the Strategy Design Pattern, and shows how you can use it to abstract result pagination processing from your app."
Mash Up Your Music with the Zend Framework
"Let Toby show you how easy it is to build killer PHP 5 web applications with Zend - like your very own music mashup that utilizes the Yahoo! APIs."
10 tips for optimizing mysql queries
PHP 101: PHP For the Absolute Beginner
"This area is intended for everyone new to PHP. It opens with a series of informal, entertaining tutorials written by Vikram Vaswani, founder and CEO of Melonfire. If you came here to learn about elementary PHP 4 or basic PHP 5, this is for you. Enjoy!"
Smarty Cheat Sheet for Template Designers
MySQL Cheat Sheet
"The MySQL cheat sheet is designed to act as a reminder and reference sheet, listing useful information about MySQL. It includes a list of the available functions in MySQL, as well as data types. It also includes a list of MySQL functions available in PHP, and a list of useful sample queries to select data from a database."
MySQL Cheat Sheet
A list of commonly-used MySQL commands, with examples of usage.
MySQL Reference Sheet
Handy Cheat-Sheet of MySQL Commands
Common MySQL commands with examples.
PHP Basics Quick Reference Sheet
Includes syntax and information for commonly used tasks.
PHP Basics Quick Reference Sheet
Includes syntax and information for commonly used tasks.
PHP cheat sheet
The PHP cheat sheet is designed to be printed on an A4 sheet of paper and live by a developers desk, to make life a bit easier. It includes helpful reminders about useful functions, date formatting, superglobals, regular expressions, and more.