Home arrow Web Standards arrow Page 4 - Configuring Servers and Databases with Chrome

Configuring Servers and Databases with Chrome

In this second part of a four-part article that explains how to prepare XUL Internet applications for a commercial setting, you'll learn how to configure servers and build a database. This article is excerpted from chapter four of Programming Firefox, written by Kenneth C. Feldt (O'Reilly, 2007; ISBN: 0596102437). Copyright © 2007 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

Author Info:
By: O'Reilly Media
Rating: 5 stars5 stars5 stars5 stars5 stars / 3
June 12, 2008
  1. · Configuring Servers and Databases with Chrome
  2. · The server-side response
  3. · When Things Go Wrong
  4. · Adding a Database
  5. · Creating account tables

print this article

Configuring Servers and Databases with Chrome - Adding a Database
(Page 4 of 5 )

Using hardcoded information in a script file may be appropriate for some limited applications, but the designer can improve the reliability of server code by allowing access to a dynamic information store without having to change any script files. Such a store can be maintained and updated to reflect the changing nature of business operations without risking any side effects caused by changes in server or client code.

Using a relational database is not a required element for this book’s sample application. If database use is inappropriate for some reason, we could write PHP “stub code” to mimic our database. The use of MySQL is included here as an example of an implementation that models true commercial applications.

The use of a relational database is the most commonly accepted technique to provide a secure and maintainable information store that server scripts can access in response to a client request. We will use the open source MySQL database engine to provide the store for our username and password information. The steps for this task are as follows:

  1. Create the NewsSearch database.
  2. Create a database user account to act as administrator.
  3. Create the tables for our account name and password.
  4. Create a database user account to act as a “guest” with read-only access to database information.
  5. Configure PHP to use libraries to access the database.
  6. Write the PHP scripts to communicate with the database in response to a client request.

Creating the database

Once we have installed MySQL, we create the database for our project.

Upon initial installation, MySQL has arootaccount that we can use to create a new table (refer to the glossary to set up a root password if you have not already done so). We log into the database with the following command:

  mysql –u root –p

You will now be prompted for the root password. When you’re successfully logged in, you will see a welcome message that looks like this:

  Welcome to the MySQL monitor. Commands end with ; or \g.
  Your MySQL connection id is 4 to server version: Version specific information

We create a database with this command:

  mysql> create database newssearch;
  Query OK, 1 row affected (0.59 sec)

blog comments powered by Disqus

- Mozilla Popcorn Maker 1.0 Makes Videos More...
- Completing a Configuration for Chrome and a ...
- Getting Connected with Firefox and Chrome
- Configuring Servers and Databases with Chrome
- Configuring Firefox for Chrome and a Server
- Designing the Elements of a Web Page
- Matching div heights with CSS and JavaScript
- Forms
- Get Down With Markup
- If I Said You Had a Beautiful Body...
- Web Standards in Dreamweaver Part 3
- Web Standards in Dreamweaver, Part 2
- Web Forms
- Making Lists Using XHTML
- Web Standards in Dreamweaver, Part 1

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials