Creating Dynamic Images from PHP
In today’s tutorial, we will take a further look at the kinds of things that you can do with PHP using one of the PHP extensions. As we have mentioned before, PHP is easily extended to include support for a variety of different 3rd party file types and protocols. Today we will start looking at an extension that lets you create images – the GD extension. This is easy to install (instructions are given) and a tutorial project is included, involving getting the EXIF data of a digital camera image, grabbing a thumbnail through the free GD library.
Database Design: Simple SQL Queries

In today's beginners' Database tutorial, we explore a sample database model for a relatively simple system. In it we  look at some good examples of the different types of relationships that tables can have in a database. We then look at a couple SQL queries based on this model.

Rob then gently takes you to the world of  SQL JOINs and how we can use them to create information from data. We also modify data in a table, through the INSERT, UPDATE and DELETE queries. We finish up with a unique example of how to filter data, through the use of the NOT IN keywords and a nested query.

Creating Calendars in PHP part 3

In this article in the series, we look at using the PHP mktime() command which allows us to create Unix timestamps for a particular date and time. By using the PHP explode() command we can split a time or date that's been entered by a user into its component parts for use with the mktime() function. We then look at the PHP strtotime() command which can perform date and time based addition and subtraction, so we can easily add or subtract a period of time to or from an existing date / time.

In the final section, we create a custom function readCalendarData() which accepts a month number and year, and searches the database to find all events on or between the start and end of the month and using SQL to turn the datetime field into a timestamp field to make it easier to work with, and to allow us to easily sort the records into order of date and time. We then modify our existing calendar code so that it checks to see if each day number exists in the array, and if it does to turn the day number into a hyperlink to allow the user to see all events on that particular day.

Please note that this article forms part of a chapter in the DMXzone e-book PHP Web Applications for Dreamweaver: Juicy Solutions for the Busy Developer.


Flash Gordon and the attack of the PHP Extensions

The basic PHP language is feature-rich and powerful enough for you to handle most web applications without any hassles. And if you’re working with PHP mainly by using the built-in Server Behaviors that come with Dreamweaver and a little bit of hand coding, you are missing out on a whole host of functionality within PHP.

This extra functionality comes through PHP’s use of extensions – libraries of code that can be loaded into PHP as and when you need them. In today’s tutorial we’ll take a look at the kinds of things that these extensions can do, talk a bit about a PHP data type that is often used when you work with PHP extensions, and then take a look at how one of these extensions work by looking at the Ming extension for PHP.

Creating Calendars in PHP – Part 2

In this tutorial we look at the advantages of removing HTML attributes from the PHP code and replacing them with CSS classes, so that the whole dynamically-produced calendar can be restyled just by changing the CSS styles and without having to change the code in any way.

We then look at the MySQL datetime field format which stores a date and time in a format which can be easily changed into a timestamp using the MySQL UNIX_TIMESTAMP() command. We look at the advantages of using the Unix timestamp format, such as making it easy to select dates using simple numerical operators and being able to automatically sort records in order of date and time.

Finally we learn how to select all events that fall on a certain date, and then at how to find all records which fall between a range of dates.

Please note that this article forms part of a chapter in the DMXzone e-book PHP Web Applications for Dreamweaver: Juicy Solutions for the Busy Developer.


Creating a Simple Email Form in PHP

You want your site's visitors to be able to contact you (to offer you work, marriage, congratulations on your genius etc) but, as soon as you put your email address on the site, you're inundated with spam and Nigerian gentlemen offering you $5 million. This tutorial shows you how to make a simple email form in PHP so that a form can be mailed to you when the user hits the submit button. Gareth then shows how to make a simple HTML mail, as well as a useful tip on how to make helpful hints appear in the status bar while the user fills in the form.

This is suitable for beginners to advanced users of PHP.

File Uploading with PHP

In this article we look at how to upload files using PHP. This technique can be extremely useful, and is used on many sites for example, in content management systems or forums which allow the user to upload an image to represent them.

In this standalone tutorial, we start by looking at how to create the HTML form required to upload files. We then look at how to upload a single file, and then expand the code to allow multiple files to be uploaded. Finally we look at some useful file handling commands, and how to read the dimensions from an image file.

This is suitable for MX and MX 2004 users, from beginners upwards.

Dreamweaver MX 2004 PHP Server Behaviors

In today's tutorial we will be taking a look at creating a log in system using PHP Server Behaviors. Our system will provide an admin area for creating/editing and deleting users from the system, as well as the log in system itself. We'll be working with the newly released Dreamweaver MX 2004 for this article, as this will give us the opportunity to work with the new user authentication Server Behaviors that have been introduced with MX 2004.

After reading this tutorial, you'll be able to:

1. Create a table of users who could log into the site, along with their respective user access levels 2. Create a login page that authenticated users against that database table using the Log In User server behavior 3. Use the Restrict Access To Page server behavior, along with some of our own code to redirect authenticated users to the correct areas of our site 4. Use the Restrict Access To Page server behavior with defined access levels to make sure that only Admin users could access the admin section of the site 5. Use the Master-Detail Page Set application object to create a structure for the admin pages.

Creating a Dynamic News Feed in PHP

In this article we look at how to create a dynamic news feed. By delivering the content of the feed as JavaScript, it can be incorporated easily into any site, as the feed is gathered by the user's browser and so does not need any special software on the host's server.

We then look at reading records from a MySQL database, putting the results in an array so that the data can be worked with easily later on in our code. We create a custom function to display a number of characters from a string, without splitting the string in the middle of a word. By making the number of characters to display a parameter of the function, we made it general- purpose, so that it can be used easily on other sites to save time in the future. We then look at displaying the news data using JavaScript.

Finally, we create a page that read a parameter from the pages URL, and uses it to select a record from the database, and we display this data on the page, so that a visitor can read the whole of their selected news item.

Grabbing an RSS Feed with PHP

A great way to add content to your site is use syndicated content from blogs, news sites etc with RSS which is Rich Site Summary (some would say Really Simple Syndication, or RDF Site Summary), and is a format used by a variety of sites for content syndication.

This tutorial uses PHP to grab the feed and incorporate it into our site. As it stands we can't do this in Dreamweaver, so we'll make a PHP script and then turn it into an extension so that you can re-use it on other pages. The PHP requires some existing understanding to make sense of, so this tutorial will be hardwork (but not impossible) for PHP newbies.

Working with Session Variables in PHP

In this tutorial, we look at using Session Variables in PHP, to store user information as a user moves backwards and forwards through the pages of a website. This allows information to be tied to a user, linking them to records in a database to create a shopping cart (for example). Session Variables are also commonly used for security systems, so that once a user has logged in their status is held in a Session Variable.

The first section that we examine is how Session Variables work, and how to enable them in PHP if they're not already enabled. We then look at how to store a value in a Session Variable, and how to avoid the common "Headers already sent" error that can occur, and how it can be stopped permanently by using Output Buffering.

We then look at how to read back a Session Variable and how to check whether a Session has been set or not. Finally, we look at when to use Session Variables and when to use Cookies, and how to destroy a Session Variable.

Backing up MySQL Databases made easy with PHP

In this tutorial, we use PHP as a scripting language to backup a number of MySQL databases so the files can either be downloaded over the web, or are automatically sent to a remote server by FTP. We then create a script which automatically restored the files again, with a minimum of manual intervention.

The system is ideal if you host your own clients, and makes it easy to make sure that all the information in your databases is regularly backed up. The system can be extended further by creating a nice web interface to the backup system, and access can be given to your clients so they can backup their own databases allowing you to offer them a better service.

Newer articles Older articles