Home arrow JavaScript arrow Page 2 - Creating a MySQL Client with AJAX to Administer Databases from the Web
JAVASCRIPT

Creating a MySQL Client with AJAX to Administer Databases from the Web


In this first article of a three-part series, I’ll show you in a friendly fashion how to create the front end of an extensible MySQL client application that uses AJAX to send queries to a selected database in the background.

Author Info:
By: Alejandro Gervasio
Rating: 4 stars4 stars4 stars4 stars4 stars / 6
August 28, 2006
TABLE OF CONTENTS:
  1. · Creating a MySQL Client with AJAX to Administer Databases from the Web
  2. · Defining a simple user interface
  3. · Adding some CSS declarations to the bare bones (X)HTML markup
  4. · Checking for login form submission

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Creating a MySQL Client with AJAX to Administer Databases from the Web - Defining a simple user interface
(Page 2 of 4 )

As I expressed in the introduction, before I proceed to create the set of JavaScript functions that will allow the execution of SQL commands against a specific MySQL database, I'll start with defining the structure of the corresponding user interface. Doing so, you'll have a clear idea not only of how the application's visual appearance will look, but how the different modules that comprise the program will interact each other.

To begin with, I'll code a simple login page, which obviously will display on the browser the corresponding login form, which will be handy for introducing the respective values needed to connect to the MySQL server. That said, here is the structural (X)HTML markup that renders the mentioned login page: 

<!doctype html public "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>MySQL Client Login Page</title>
<meta http-equiv="Content-Type" content="text/html;charset=iso-
8859-1" />
</head>
<body>
<div id="maincontainer">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
<p>MySQL Client Login</p>
<p>Server Host <input type="text" name="host" title="Enter
MySQL's hostname" /></p>
<p>User <input type="text" name="user" title="Enter your user
name" /></p>
<p>Password <input type="password" name="pass" title="Enter your
password" /></p>
<p>Database <input type="text" name="database" title="Enter
database name" /></p>
<p><input type="submit" name="connect" value="Connect"
class="button" /></p>
</form>
</div>
</body>
</html>

Basically, what I did above was simply code a basic login page, which as I said previously, will let users enter the set of parameters required for connecting to MySQL, as well as for selecting a specific database. The above web form reflects  this concept, since it's composed of four input boxes: host name, user name and password, and finally the database to be queried. So far, nothing unexpected, right?  

All right, after coding the web page shown above, you should notice that the login form points to itself (note the inclusion of the $_SERVER['PHP_SELF'] variable as the value that corresponds to its action attribute), in order to perform a basic validation on the connection parameters once the form has been submitted.

Of course, this is merely an optional approach that can be easily changed if you want to perform a thorough verification of all the inputted parameters on a different web page. In this case, since I want to keep the entire login process reduced to only one web document, I followed the method that I explained before.

Well, now that the login web page that will allow connecting to MySQL and selecting a particular database has been created, have a look at the following screen shot, which depicts the look and feel of the page in question:

As you can see, the above image shows the basic visual appearance of the respective login page, where users will be able to enter the name of the MySQL host to connect to, the username/password combination and lastly the name of the database to be queried.

In addition, it should be noticed that the previous screen shot depicts a slightly styled version of the login web page that I coded before, since the initial example only showed the bare bones structural markup. Keeping this condition in mind, in the following section I'll be adding some CSS declarations to the original login web document, in this way obtaining a look and feel closely similar to the one shown above.

To learn more about how this will be done, please go ahead and read the following lines. I'll be there, waiting for you.


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



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