Home

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

|
|  Updated:  
2016-03-27 10:14:24
HTML5 and CSS3 All-in-One For Dummies
Explore Book
Buy On Amazon

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:

Connect to phpMyAdmin.

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

Navigate to the correct database.

Navigate 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.

Activate the SQL pop-up window.

Activate the SQL pop-up window.

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

Type 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.

Move to the Import Files tab.

Move 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
MySQL.

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.

Examine your handiwork.

Examine 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.)

About This Article

This article is from the book: 

About the book author:

Andy Harris earned a degree in Special Education from Indiana University/Purdue University–Indianapolis (IUPUI). He taught young adults with severe disabilities for several years. He also taught himself enough computer programming to support his teaching habit with freelance programming.
Those were the exciting days when computers started to have hard drives, and some computers connected to each other with arcane protocols. He taught programming in those days because it was fun.
Eventually, Andy decided to teach computer science full time, and he still teaches at IUPUI. He lectures in the applied computing program and runs the streaming media lab. He also teaches classes in whatever programming language is in demand at the time. He has developed a large number of online video-based courses and international distance education projects.
Andy has written several books on various computing topics and languages including Java, C#, mobile computing, JavaScript, and PHP/MySQL.
Andy welcomes comments and suggestions about his books. He can be reached at [email protected].