Bạn có thể dán các lệnh này trực tiếp vào giao diện điều khiển MySQL, hoặc bạn có thể chạy lệnh sau đây (từ Linux hoặc Windows dấu nhắc lệnh): $ mysql-u phpweb20-p ch05_exampleLưu ý mã SQL trong cũng sẽ chỉ làm việc tốt trong PostgreSQL (mặc dù các lệnh để | Simpo PDF Merge and Split Unregistered Version - http CHAPTER 5 INTRODUCTION TO PROTOTYPE AND SCRIPTACULOUS 159 insert into items insert into items insert into items insert into items insert into items insert into items title title title title title title values values values values values values Car Chair Door House Table Window Note The SQL code in will also work just fine in PostgreSQL although the commands to create the database and user will be different . You can either paste these commands directly into the MySQL console or you could run the following command from the Linux or Windows command prompt mysql -u phpweb20 -p ch05_example In the preceding table schema the ranking column is used to store the order of the list items. This is the value that is manipulated by clicking and dragging items using the Scriptac-ulous Sortable class. Note At this stage we aren t storing any value for the ranking column. This will only be saved when the list order is updated. In the PHP code you will see that if two or more rows have the same ranking value they will then be sorted alphabetically. Managing the List Items on the Server Side We must now write the server-side code required to manage the list items. Essentially we need a function to load the list of items and another to save the order of the list. We will look at how these functions are utilized shortly. In addition to these two functions we also need to include a basic wrapper function to connect to the database. In larger applications you would typically use some kind of database abstraction such as the Zend_Db class we integrated in Chapter 2 . All of the code in this section belongs in the file. Connecting to the Database Listing 5-11 shows the code used to connect to the MySQL database. Listing 5-11. The dbConnectO Function Which Connects to a MySQL Database Called ch05_example php function dbConnect Simpo PDF Merge and Split Unregistered .