How to Run a Script with phpMyAdmin in SQL for HTML5and CSS3 Programming - dummies

How to Run a Script with phpMyAdmin in SQL for HTML5and CSS3 Programming

By Andy Harris

phpMyAdmin provides terrific features for working with SQL scripts for HTML5 and CSS3 programming. You can write your script directly in phpMyAdmin, or you can use any text editor. Your editor can really help you. Consider a text editor like Notepad++ or Komodo Edit, which both support syntax coloring for SQL. This can really help you find mistakes in your code.

If you’ve written a script in some other editor, you’ll need to save it as a text file and import it into phpMyAdmin.

To run a script in phpMyAdmin, follow these steps:

1Connect to phpMyAdmin.

Be sure that you’re logged in and connected to the system.

2Navigate to the correct database.

Typically, you use a drop-down list to the left of the main screen to pick the database. This phpMyAdmin screen has the haio database enabled.

3Activate the SQL pop-up window.

You can do so by clicking the small SQL icon in the left-hand navigation menu.

4Type your SQL code directly into this dialog box.

This shortcut is good for making quick queries about your data, but generally you create and initialize data with prewritten scripts.

5Move to the Import Files tab.

In this tab, you can upload the file directly into the MySQL server. Click the Choose File button to locate your file and the Go button to load it into

You may be nervous that you’ll overwrite the data. You will, but for this stage in the process, that’s exactly what you want. The point of a script is to help you build a database and rebuild it quickly. After you have meaningful data in the table, you won’t be rebuilding it so often, but during the test and creation stage, this skill is critical.

6Examine your handiwork.

Look back at the phpMyAdmin page. It shows your script and, if you ended with a SELECT statement, an output of your table. (Later versions of phpMyAdmin display only the last statement in the script, but all are executed unless there is an error in your script.)