![](https://csdnimg.cn/release/download_crawler_static/10024091/bg11.jpg)
xv
Table of Contents
Using Loops .................................................................................................. 191
Using for loops
................................................................................... 192
Using while loops
...............................................................................194
Using do..while loops
........................................................................ 196
Innite loops
.......................................................................................197
Breaking out of a loop
....................................................................... 199
Using Functions
........................................................................................... 201
Using variables in functions
............................................................. 203
Passing values between a function and the main program
..........204
Using built-in functions
.....................................................................209
Chapter 8: Data In, Data Out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .211
PHP and MySQL Functions .........................................................................212
Making a Connection
................................................................................... 214
Connecting to the MySQL server
..................................................... 214
Selecting the right database
............................................................. 218
Sending SQL queries
.......................................................................... 219
Getting Information from a Database
........................................................ 220
Sending a SELECT query
...................................................................220
Getting and using the data
................................................................221
Using functions to get data
...............................................................228
Getting Information from the User
............................................................232
Using HTML forms
.............................................................................233
Making forms dynamic
...................................................................... 238
Using the information from the form
.............................................. 251
Checking the information
................................................................. 253
Giving users a choice with multiple submit buttons.....................263
Putting Information into a Database
.........................................................265
Preparing the data
.............................................................................265
Adding new information....................................................................270
Updating existing information
.......................................................... 276
Getting Information in Files
........................................................................ 279
Using a form to upload the le
......................................................... 280
Processing the uploaded le
............................................................280
Putting it all together.........................................................................282
Chapter 9: Moving Information from One Web Page to the Next . . .285
Moving Your User from One Page to Another .........................................286
Moving Information from Page to Page
.................................................... 289
Adding information to the URL
........................................................290
Storing information via cookies
.......................................................294
Passing information with HTML forms
........................................... 297
Using PHP Sessions
..................................................................................... 298
Understanding how PHP sessions work
......................................... 298
Opening sessions
...............................................................................299
www.it-ebooks.info