Communicating with the Server of a MySQL Client with AJAX
Looking for a comprehensive tutorial that shows you how to create a MySQL client application with the help of AJAX? Then this is the article you’ve been waiting for! Welcome to the concluding part of the series "Creating a MySQL Client with AJAX." In three parts, this series walks you through the process of building a simple application that allows you to run select, insert, update and delete SQL commands against a given MySQL database table, all from your own browser.
Communicating with the Server of a MySQL Client with AJAX - Refresher course: the MySQL client's login module (Page 2 of 4 )
Naturally, before I proceed to write down the PHP snippet that processes queries typed in by the user, first I’d like you to take a quick look at some of the application’s previous modules. Doing so, you’ll have a better idea of how each piece fits into each other, prior to coding the mentioned server-side script.
Bearing in mind this logical concept, I’ll begin listing the full source code that corresponds to the login module of the MySQL client application. Here it is:
As you’ll certainly remember, the file listed above comprises the login module of the application, and obviously is responsible for collecting the parameters required for connecting to MySQL, as well as for selecting a specific database. In addition, the previous file also redirects the user to the main page of the client application, called “mysql_client.php,” after the login form has been submitted successfully. Nothing unexpected, right?
After reviewing the respective signature of the login module that was shown a few lines ago, I hope now that this mechanism is fresh in your mind. Now, let’s continue this journey and take a quick look at the other core module of the MySQL client application. In this case, I’m talking about the AJAX-based mechanism, tasked with sending out all the typed queries to the server, as well as displaying results back in the client.
To see how this important module was originally created, please go ahead and read the following section.