Str Variable Value: <?=$Groupid?> 2-I Variable Value: <?=$I?>

5

6

Figure 1.12. Create data fields for the table

4) Add data to the Table Step 1. Select the table Step 2. Click the Insert link Step 3. Enter data Step 4. Click the Go button

For example:Add 2 records to the theloai table as follows:


TenTL

ThuTu

AnHien

Social news

1

1

Entertainment

2

2

Maybe you are interested!

2

1

3

4

Figure 1.13. Enter data for the table

5) View data in Table

Step 1. Select the table you want to view data from. Step 2. Click the Browse link.

Show 25 records at a time

For example:View data in the theloai table.

2

1

Figure 1.14. Viewing table data

6) Delete/Edit data in Table

Step 1. Select the table you want to delete or edit (for example theloai). Step 2. Click the Browse link.

Step 3. Edit/delete.

Edit record: Click the Edit button (pencil) on the line containing the record. Delete record: Click the Delete button on the line containing the record.

2

1

3

Figure 1.15. Deleting and editing table data

7) Edit Table structure

Step 1. Select table

Step 2. Click the Structure link Step 3.

Edit field: Click Change button Delete field: Click Drop button

Add column: Click Go button in Add section


Figure 1.16. Edit table structure

8) Rename Table

Step 1. Select the table to rename Step 2. Click the Operations link

Step 3. Rename table to: enter new name Step 4. Click Go button

For example:Rename table theloai to theloaitin

2

13

1

4

Figure 1.17. Rename a data table

9) Delete Table

Step 1. Select database

Step 2. Select the table to delete and click the Drop link

For example:Delete the group table

1

2

Figure 1.18. Delete data table

10) Import Table

Step 1. Select database Step 2. Click Import link

Step 3. Click the Browse button to select the .sql file Step 4. Click the Go button

For example:Import data from file db1.sql

2

1

3

4

Figure 1.19. Import data from sql file

11) Export Table

Step 1. Select the database to export Step 2. Click the Export link

Step 3. Export: select the tables to export Step 4. Select Save output to a file

Step 5. Select the file type as SQL and click the Save button

For example:Export all tables in the tintuc database to the dbtin.sql file

2

1

3

4

5

Figure 1.20. Export data from sql file

12) Delete Database

Step 1. Click on database name Step 2. Click on Drop link

For example:Delete news database

1

2

3

Figure 1.21. Delete database

1.6. Exercises

1. Install and configure Webserver using Appserv software.

2. Install and configure Webserver using Wampserver software.

3. Use phpmyAdmin to create database

CHAPTER 2: PROGRAMMING WITH PHP


2.1. Structure of PHP

2.1.1. Statements in PHP

PHP is a server script that runs on the PHP Engine, along with a Web Server application to manage them. Commonly used Web Servers are IIS, Apache Web Server, ...

PHP page translation

When the user calls the PHP page, the Web Server calls the PHP Engine to interpret the PHP page and return the result to the user as shown below:

Figure 2.1. PHP page translation process

Use a text editor like notepad or PHP editing software like Design, EditPlus, Dreamweaver, notepad++, Netbean, zendstudio …. Name the files *.php.

For PHP allows interleaving between HTML commands and PHP commands. Therefore, PHP is considered as a script like Javascript or Vbscript.

PHP commands use the following syntax: Method 1: Main syntax:

<?php PHP code ?>

Method 2: Short syntax

<? PHP code ?>

Method 3: Syntax is similar to ASP.

<% PHP code %>

Method 4: Syntax starting with script

<script language=php>

.....

</script>

In PHP to end a command line we use the ";" sign.

For example:

1-Variable Str value: <?=$groupid?> 2-Variable i value: <?=$i?>

3-Old value: <?=10?>

For example, declare the hello.php page with content like the following example:

For example:hello.php page

<HTML>

<HEAD>

<TITLE>::Welcome to PHP</TITLE>

</HEAD>

<BODY>

Greeting: <?="Hello PHP"?>

</BODY>

</HTML>

The result is as shown when calling this page on the browser.




For example:


<?php


?>

Figure 2.2. Result of executing hello.php page


$pagenumber=$pagenumber;

$record=$rownumber;

$totalRows = 0;

$paging="";

Comment


Agree Privacy Policy *