Friday, May 25, 2012

Interacting with a MySQL Database Table in PHP

Now that you can create HTML forms and receive HTTP POST data and properly set up a table in a MySQL database, you are ready for the next step: interacting with this MySQL database through the use of an HTML form. All that's left for you to know and do is run MySQL queries from PHP code. Here's the script we're going to be looking at in this tutorial:

Tuesday, May 22, 2012

Setting up Tables in a MySQL Database

When you're about to include a MySQL database in a project you're working on, you're going to want to plan ahead and figure out what kind of layout this database should use. After all, you can't use a database without first creating it!

You could start by creating this database's structure using PHP code, but it would be incredibly hard to get everything right the first time! My recommendation is to do what I always do: start out by using Adminer or PHPMyAdmin to view the database and structure it manually. Adminer and PHPMyAdmin are two of the most common PHP scripts that you can use to access your database without needing to write code. One or both of them are usually included somewhere in your CPanel - if you're using a CMS like WordPress, you should be able to find a plugin for one of them or something.

Friday, May 18, 2012

Creating HTML Forms and Receiving HTTP POST Data

In my previous post, I showed you how to use HTTP GET to transfer/receive data through a page's URL (as well as how to intermingle PHP code with HTML code). What if you want the user to submit data through an HTML form to your website? That's where HTTP POST comes in.

There are two parts to making standard HTML forms: the HTML form code itself (including graphics, placement, text, and logic/data) and the PHP script that will retrieve the form data. We'll start with a brief overview of how you might want to make the form.

Wednesday, May 16, 2012

Working with PHP HTTP GET Variables

This tutorial assumes you know the basics of how HTML and PHP work together. The better your understanding of their relationship, the easier this tutorial will be to understand.

What makes a website different from a picture? It usually has interactivity (buttons, links, videos, etc.), but it also has something else: customizability. If it has an account system, for instance, you can enter your username and password, and it will check its database for your credentials.

Once signed in, you will receive a more personalized web page, perhaps with information such as Facebook notifications, new Youtube channel subscribers, or the amount of money you have in your Paypal account. How does this work when you're using HTML and PHP? That's what this tutorial is going to help with.