JavaScript
  Home arrow JavaScript arrow Page 2 - Creating a MySQL Client with AJAX to Admin...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Creating a MySQL Client with AJAX to Administer Databases from the Web
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 6
    2006-08-28

    Table of Contents:
  • Creating a MySQL Client with AJAX to Administer Databases from the Web
  • Defining a simple user interface
  • Adding some CSS declarations to the bare bones (X)HTML markup
  • Checking for login form submission

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    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.

    More JavaScript Articles
    More By Alejandro Gervasio


       · This first article of the series is focused on defining the front end of the MySQL...
       · Great start! Cant wait for more!
       · Thank you for the compliments on my AJAX article. I hope you enjoy reading the next...
       · This is great! When can we expect the next article? Good job mang!
       · Thank you for the kind comments about my AJAX article. I'm not completely sure, but...
       · Hi Alejandro,Very interesting article, I've been trying out the code.I'm a...
       · Thank you for the compliments on my Ajax-driven MySQL client, and I’m glad to know...
     

    JAVASCRIPT ARTICLES

    - Using Click Interceptions with a Database-Dr...
    - Using JavaScript Click Interceptions in an I...
    - Using Click Interceptions with JavaScript
    - QuickSort in Action
    - Quicksort
    - Using Mod_Security to Protect Your Server
    - Detecting and Countering Server Intrusions
    - Securing Your Web Server
    - Building a Secure Web Server
    - Protecting the Server
    - Book Review: Learning the Yahoo! User Interf...
    - Dynamically Generate a Selection List in a R...
    - Intergrate DWR into Your Java Web Application
    - Detect Browser Compatibility with the Reques...
    - Using the EXT JS Date Picker Widget






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT