The WHILE loop is one of the most useful commands in PHP. It is also quite easy to set up and use – granted it might look a bit complicated. First off however let’s figure out just what the hell a WHILE loop is – and what we need it for. A WHILE loop will, […]
Tag Archives: php
Sending Mail with PHP
Mail is extremely easy to send from PHP, unlike using scripting languages which require special setup (like CGI). There is actually just one command, mail() for sending mail. In this tutorial we will discuss how to use PHP’s mail() function. It is used as follows: mail($to,$subject,$body,$headers); In this example I have used variables as they have […]
PHP Tutorials
Looking to dive into the wonderful world of PHP & MySQL? The following tutorials should help you get started. [divider3 text=”The Basics”] Echo(); Chances are you’re familiar with the Hello World exercise by now. It’s the starting point for learning almost any programming language. PHP is no different. So let’s dive right into it. How […]
PHP/MySQL File Upload – Error Checking
A while back I had written a PHP/MySQL tutorial discussing how to upload an image to your server, and store the information about that uploaded image into your MySQL database. That tutorial covered really only the basics, and I knew that eventually someone would post a comment asking about some more advanced features – such as […]
Want To Play With PHP 5.5? Meet CloudLinux.
PHP 5.5 is still in the Alpha stages of it’s release, and as such the majority of hosting companies out there don’t have it available yet across their networks. CloudLinux however doesn’t believe in that. Not when they have the PHP Selector tool in their arsenal. With the CloudLinux PHP Selector you can set a […]
Basic PHP Template System
PHP has many different template solutions, and the beauty of them all is how simple it makes maintaining and changing your website. Back in the day when everything was handled with static HTML files – if you needed to add a new link to your main menu – you found yourself editing dozens if not […]
How PHP Functions Work
A PHP function is merely a block of code that can be defined once and then reused throughout various other parts of your script/program. Typically, a function takes an argument, or a series of arguments, and performs a predefined set of operations on them – returning a value as a result. With PHP functions, code […]
The PHP Ternary Operator
PHP has plenty of different operators, the majority of them being either unary or binary operators. A unary operator, such as !, performs its operations on just one single value. A binary operator, such as =, is used to perform an operation on two operads. So following the naming logic you’ve probably already figured out […]
File Upload via PHP/MySQL
As per the request of Spaculus I have decided to put together a tutorial discussing how to upload an image to your server, and store the information about that uploaded image into your MySQL database. This is a function that can often come in handy when developing a user membership system with avatar support, or a […]
Escaping Characters and Variable Expansion
Escaping characters is basic, but essential to an error-free PHP script. Consider the following sentence for example: Mike’s uncle said, “Isn’t that cool?” Now if we attempt to use PHP to echo this sentence to the browser, those quotes and apostrophes will cause some problems. The quotes and apostrophes inside the string are confused for […]
PHP 5.4 Released
The PHP development team is proud to announce the immediate availability of PHP 5.4.0. Sadly however – most servers and hosting companies out there are still running PHP 5.2.x – so while the release of PHP 5.4.0 comes as great news, many of you probably won’t experience it for another year or so. Before we get […]
Display Page Loading Time
Have you ever noticed that lots of websites feature some text towards the very bottom of a page saying “Page took x.xxx seconds to load”? It’s a pretty simple thing to make and gives your site something that we all love … stats! So today we’ll take a look at how to accomplish this through […]
Connecting to a MySQL Database
None of our previous PHP tutorials have dealt with a database yet, and that is for the sole reason that not everyone has access to a database, however for those who do this tutorial will teach you the basics on how you can connect to your database. We wont be covering SQL queries and the […]
PHP Variables – Understanding The Basics
If you have ever looked through any programming language – or still remember those algebra classes when you learned what 3+x=5 means then you already know what a variable does. A variable stands for something else, or in PHP it stores something inside of it so that you can recall it later on in your […]
Getting Things Started With An Echo();
Chances are you’re familiar with the Hello World exercise by now. It’s the starting point for learning almost any programming language. PHP is no different. So let’s dive right into it. How do we display things using PHP?