PHP 5/MySQL Programming- P10

PHP 5/MySQL Programming- P10:computer programming has often been seen as a difficult and arcane skill. Programming languages are difficult and complicated, out of the typical person’s reach. However, the advent of the World Wide Web has changed that to some extent. It’s reasonably easy to build and post a Web page for the entire world to see. The language of the Web is reasonably simple, and numerous applications are available to assist in the preparation of static pages | 23 FIGURE I hate it when the warthog s in the kohlrabi. Chapter 2 Using Variables and Input Using Variables in Your Scripts The most important new idea in this chapter is the notion of a variable. A variable is a container for holding information in the computer s memory. To make things easier for the programmer every variable has a name. You can store information in and get information out of a variable. Introducing the Hi Jacob Program The program featured in Figure uses a variable although you might not be able to tell simply by looking at the output. You can t really see anything special about this program from the Web page itself even if you look at the HTML source . To see what s new look at the source code. html head title Hi Jacob title head body h1 Hi Jacob h1 24 h3 Demonstrates using a variable h3 PHP 5 MySQL Programming for the Absolute Beginner userName Jacob print Hi userName body html figure The word Jacob is stored in a variable in this page. In regular HTML and JavaScript programming you can use the Web browser s view source command to examine your program code. For server-side languages this is not sufficient the view source document has no PHP at all. Remember that the actual program code never gets to your Web browser. Instead the program is executed on the server and the program results are sent to the browser as ordinary HTML. Be looking at the actual PHP source code on the server when examining these programs. On a related note you cannot simply use your browser s File menu to load a PHP page. Instead run it through a server. 25 The helloJacob page is mainly HTML with a small patch of PHP code in it. That code does a lot of very important work. Creating a String Variable The line userName Jacob does two major things. First it creates a variable named userName. Second it will assign the value Jacob to the variable. In PHP all variables begin with a dollar sign to distinguish them from other program elements. The variable

Không thể tạo bản xem trước, hãy bấm tải xuống
4    18    1    21-03-2023
175    6    1    21-03-2023
10    6    1    21-03-2023
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.