You are on page 1of 7

Editor : Pham Huu Khang

Editing: Phuong Lan

Web programming using PHP 5.3 and MySQL 5.1 database

Volume 1

Phuong Dong Publishing House

INTRODUCTION

The open-source content management application Joomla has been and is proving its
power in the era of e-commerce, it has contributed to the development of the Web 2.0 world.
If given the choice to develop Web applications in the context of globalization, we can
choose open source technology to execute our strategy due to acceptable development and
operating costs.

From a business perspective, you can easily and quickly create a Web site with all the
necessary features. Therefore, when customers want to build Web applications at a
reasonable cost, they really cannot choose a solution other than Joomla. However, when
working with Joomla, you may also face a lot of problems with structure, presentation
templates, databases and source code. That's why you aim to approach Web site structure
and PHP scripting.

Going further, you can learn the HTML tags and declarations of PHP scripts and SQL
statements by yourself in the MySQL database so that you can build your own Web
applications.

Volume 1 of the book "Web Programming with PHP 5.3 and MySQL 5.1 Database"
includes 7 chapters and attachments. Chapter 1 provides you with an understanding of the
Web site's functionality, installs the WampServer 2.0 package, and configures it to run Web
applications using PHP, MySQL, and Apache Web Server.

In Chapter 2, you continue to learn how to create Web sites and design structures for
businesses using the open-source content management system Joomla. To satisfy the
presentation, you continue to learn how to design static or dynamic Web pages using native
PHP code with Dreamweaver CS software in chapter 3 and HTML tags in chapter 4 .

Next, you can learn the syntax of the PHP script in Chapter 5 and learn how to use the
PhpMyAdmin application to administer the MySQL database in Chapter 6. In Chapter 7 you
learn the SQL statement of the database. MySQL was used to build online sales
applications.
TABLE OF CONTENTS

INTRODUCE ................................................................................................................. 3

OPEN LETTER ............................................................................................................. 5

TABLE OF CONTENTS ................................................................................................ 7

Chapter 1: INTRODUCTION WEB APPLICATION .......................................................13

1. Web Application Introduction ....................................................................................13

2. Some types of Web sites ........................................................................................15

2.1 . Introduce ..............................................................................................................17

2.2 . Products and services ........................................................................................18

2.3 . Sign up for an account........................................................................................18

2.4 . Search..................................................................................................................18

2.5 . Shopping cart and order .......................................................................................18

2.6 . Other functions .....................................................................................................19

3. Explanation of some key functions ...........................................................................20

3.1 . Register for a user account ..................................................................................20

3.2 . Login Function......................................................................................................21

3.3 . Function Change Password .................................................................................23

3.4 . Function Forgot Password ....................................................................................23

3.5 . Product Search Function ......................................................................................24

3.6 . Product Listing Function .......................................................................................25

3.7 . Shopping Cart Function ........................................................................................26

3.8 . Order function ......................................................................................................27

3.9 . Website Development Tools .................................................................................28

3.10 . Install the WampServer 2.0 package ..................................................................29

4. End of Chapter .........................................................................................................49

Chapter 2: LEARNING JOOMLA CONTENT MANAGEMENT SYSTEM ......................47


1. Brief introduction of Joomla ......................................................................................47

2. Several versions and architectures of Joomla ..........................................................47

2.1 . Version .................................................................................................................50

2.2 . Organization structure ..........................................................................................50

3. Install Joomla ...........................................................................................................51

3.1 . WAMP Windows...................................................................................................52

3.2 . MAMP Apple Mac OSX ........................................................................................52

3.3 . Windows, Linux, Solaris ......................................................................................52

4. Building a Web site with Joomla ...............................................................................60

4.1 . Change menu.......................................................................................................61

4.2 . Change content element ......................................................................................75

4.3 . Edited ...................................................................................................................76

5. End of Chapter .........................................................................................................86

Chapter 3: WEB DESIGN WITH ADOBE DREAMWEAVER CS3.................................87

1. Introduction to Adobe Dreamweaver CS3 ................................................................88

2. Functions of Dreamweaver CS3 ...............................................................................89

3. Create and Manage WebSite ...................................................................................94

4. Design Static Websites ............................................................................................95

4.1 . First row ...............................................................................................................99

4.2 . Second row ........................................................................................................100

4.3 . Third row ............................................................................................................102

5. Create Dynamic Web Pages ..................................................................................108

5.1 . Data presentation ...............................................................................................108

5.2 . Presenting data with pagination and navigation ..................................................115

5.3 . Input page design ...............................................................................................132

5.4 . Data update page design ...................................................................................132

6. End of Chapter .......................................................................................................136

Chapter 4: DISCOVER HTML CARD .........................................................................137


1. HTML Page Basics ................................................................................................137

2. Web Site Structure .................................................................................................138

3. Common HTML tags ..............................................................................................139

3.1 . The < head > ... </ head > ..................................................................................139

3.2 . The < title > ... </ title > .......................................................................................139

3.3 . The < body > ... </ body > ..................................................................................140

3.4 . Format card ........................................................................................................140

3.5 . Table Format Cards ...........................................................................................147

3.6 . Picture card ........................................................................................................148

3.7 . Link card ............................................................................................................151

3.8 . The Input ............................................................................................................157

3.9 . The < textarea > card .........................................................................................158

3.10 . The < select > card...........................................................................................158

3.11 . The <form> card ...............................................................................................160

4. Special HTML tag ...................................................................................................162

4.1 . The <meta> card ................................................................................................162

4.2 . The < marquee > card ........................................................................................168

4.3 . The <style> card...............................................................................................169

4.4 . The <link> card ..................................................................................................171

5. Structure of the <script> tag with JavaScript ..........................................................172

6. End of Chapter .......................................................................................................176

Chapter 5: PHP 5.3 SERVER Script Programming ....................................................177

1. PHP Server Script Introduction ...............................................................................177

1.1 . History of the PHP server script..........................................................................178

1.2 . New features in PHP 5.3 ....................................................................................178

1.3 . PHP and HTML code .........................................................................................178

2. Variables of the PHP server script ..........................................................................183

2.1 . Declare the variable ................................................................................................


2.2 . Assign the value to the variable ..........................................................................184

2.3 . String concatenation...........................................................................................184

2.4 . Identification .......................................................................................................185

3. $_POST and $_GET function ................................................................................186

3.1 . Get value from the form ......................................................................................187

3.2 . Get value from Query String ...............................................................................187

3.3 . Check tag name or parameter ............................................................................190

4. PHP Data Type ......................................................................................................195

4.1 . Data type conversion ..........................................................................................196

4.2 . Variable variation................................................................................................196

4.3 . PHP constants ...................................................................................................196

4.4 . Array data type ...................................................................................................197

4.5 . Function for string type .......................................................................................198

5. Operators in PHP and C .........................................................................................199

5.1 . Arithmetic operations ..........................................................................................209

5.2 . Associative assignment operation ......................................................................209

5.3 . Comparative math ..............................................................................................210

5.4 . Maths? ...............................................................................................................210

5.5 . Precedence of operation in PHP ........................................................................212

6. PHP Server Script Functions ..................................................................................212

6.1 . Functions available.............................................................................................212

6.2 . User-defined function .........................................................................................212

7. Insert files in PHP ...................................................................................................214

7.1 . Cost....................................................................................................................214

7.2 . Reliability ............................................................................................................214

7.3 . Consistency........................................................................................................214

7.4 . Use the require() function ...................................................................................215

7.5 . Use the include() function ...................................................................................219


8. End of Chapter .......................................................................................................220

Chapter 6: EXPLORE MYSQL DATABASE ADMINISTRATION WEB SITE ..............221

1. About PhpMyAdmin Website ..................................................................................221

2. Database creation and management function ........................................................226

2.1 . Create a database ..............................................................................................227

2.2 . Delete database .................................................................................................227

3. Table Design and Data Types ................................................................................230

3.1 . Create a data table .............................................................................................231

3.2 . Change table structure .......................................................................................231

3.3 . Datatypes ...........................................................................................................233

3.4 . Other attributes ..................................................................................................236

3.5 . Relationships between data tables .....................................................................237

3.6. Add, delete and edit data....................................................................................241

3.7 . Delete data table ................................................................................................244

3.8 . Printing ...............................................................................................................255

4. Database administration function ...........................................................................256

4.1 . Import and Export data .......................................................................................256

4.2 . Database Management ......................................................................................263

5. User Permissions ...................................................................................................264

5.1 . Create a new user ..............................................................................................264

6. End of Chapter .......................................................................................................268

Chapter 7: MYSQL DATABASE 5.1 ...........................................................................269

1. Introduction to MySQL 5.1 database ......................................................................269

1.1 . Data column name .............................................................................................270

1.2 . Data Type Constraints ........................................................................................271

1.3 . The numeric data type ........................................................................................272

1.4 . Date and Time data type ....................................................................................273

1.5 . String data type (character string) ......................................................................274


2. SQL statement .......................................................................................................275

2.1 . Data Manipulation SQL statement group ............................................................276

2.2 . Function Common in MySQL ............................................................................284

2.3 . Select SQL statement with AS keyword .............................................................285

2.4 . Select SQL statement with Limit N , M ...............................................................286

2.5 . INSERT SQL statement .....................................................................................287

2.6 . UPDATE SQL statement ....................................................................................288

2.7 . DELETE SQL statement ....................................................................................288

2.8 . JOIN clause.......................................................................................................289

2.9 . union math ( union ) ...........................................................................................293

3. Create a View object ..............................................................................................294

4. Intrinsic Procedure Programming in MySQL ...........................................................297

5. End of Chapter .......................................................................................................302

You might also like