Developing Web Applications – Part III LG #50

Rate this post

indexnew-6147364 homenew-1230566 back2-4678693 fwd-4780256

At this time, I will close the Developing Web Applications series with a very helpful example that if you understand it, you will be able to apply the same type of application to several other types of online applications. I am talking about creating your own online bookmark. Once you understand this example, you will be able to do basic mySQL operations with php3.

But before I get to the php3 code for the bookmark application, you will need to create a mysql table to store your bookmarks. There are several ways to administrate mySQL databases:

  • Command Line: You can create all your tables, insert data, and query them out from the mysql client. To do this, I would suggest you read the mySQL Language reference at
  • GUI Based: You can download several different types of graphical interface to administrator a mysql database. For example: xmysql and kmysql. To download this tools, I would suggest:
  • Online Interface: This is definitely my favorite option. There is a very nice tool called  phpMyAdmin, which allows you to administrate one or more mySQL database remotely through your browser. Here is the URL:

Choose whatever fits you better. For this small project, I will give you the configuration that fits the needs for this application.

    Database Host: myserver
    Username: myusername
   Password: mypassword
   Database Name:  mydatabase
   Table Name: bookmark
    Fields in the bookmark table:  id, url, description

All the information above is relevant when coding the application. Note: The fields are the columns on the database. The id was defined to allow every entry in your database to be unique (primary key), it should be defined to be unique, and auto-increment.

Lire aussi...  NT OS Loader + Linux mini-HOWTO: Abstract

Once you have your database defined and working, you may start coding your application, and here is how it goes:

The HTML form that will capture the data and send it in to the database: [text copy of this listing]

    Anderson's bookmark

Enter The Bookmark Title:

Enter The Bookmark URL:

View Bookmarks The above form will have to text fields: one for the URL, the other for the URL description. The form tag will be responsable for telling the browser what to do when the Submit button is pressed. In this case it will call the php3 script sendbook.php3, and send the data to that script.

The following script is the sendbook.php3. This script will open a connection to the mySQL database, and send the data from the HTML form to the database. [text copy]