PHP Introduction. Some info on MySQL which we will cover in the next workshop...

Size: px
Start display at page:

Download "PHP Introduction. Some info on MySQL which we will cover in the next workshop..."

Transcription

1 PHP and MYSQL

2 PHP Introduction PHP is a recursive acronym for PHP: Hypertext Preprocessor -- It is a widely-used open source general-purpose serverside scripting language that is especially suited for web development and can be embedded into HTML.

3 PHP Introduction > PHP is a server-side scripting language > PHP scripts are executed on the server > PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.) > PHP is open source software > PHP is free to download and use

4 PHP Introduction > PHP runs on different platforms (Windows, Linux, Unix, etc.) > PHP is compatible with almost all servers used today (Apache, IIS, etc.) > PHP is FREE to download from the official PHP resource: > PHP is easy to learn and runs efficiently on the server side

5 PHP Introduction Some info on MySQL which we will cover in the next workshop... > MySQL is a database server > MySQL is ideal for both small and large applications > MySQL supports standard SQL > MySQL compiles on a number of platforms > MySQL is free to download and use

6 PHP Introduction Instead of lots of commands to output HTML (as seen in C or Perl), PHP pages contain HTML with embedded code that does "something" (like in the next slide, it outputs "Hi, I'm a PHP script!"). The PHP code is enclosed in special start and end processing instructions <?php and?> that allow you to jump into and out of "PHP mode."

7 PHP Introduction

8 PHP Introduction PHP code is executed on the server, generating HTML which is then sent to the client. The client would receive the results of running that script, but would not know what the underlying code was. A visual, if you please...

9 PHP Introduction

10 PHP Getting Started On windows, you can download and install XAAMP. With one installation and you get an Apache webserver, database server and php.

11 PHP Hello World Above is the PHP source code.

12 PHP Hello World It renders as HTML that looks like this:

13 PHP Hello World This program is extremely simple and you really did not need to use PHP to create a page like this. All it does is display: Hello World using the PHP echo() statement. Think of this as a normal HTML file which happens to have a set of special tags available to you that do a lot of interesting things.

14 In PHP, we use // to make a single-line comment or /* and */ to make a large comment block. PHP Comments

15 PHP Variables > Variables are used for storing values, like text strings, numbers or arrays. > When a variable is declared, it can be used over and over again in your script. > All variables in PHP start with a $ sign symbol. > The correct way of declaring a variable in PHP:

16 PHP Variables > In PHP, a variable does not need to be declared before adding a value to it. > In the example above, you see that you do not have to tell PHP which data type the variable is. > PHP automatically converts the variable to the correct data type, depending on its value.

17 PHP Variables > A variable name must start with a letter or an underscore "_" -- not a number > A variable name can only contain alpha-numeric characters, underscores (a-z, A-Z, 0-9, and _ ) > A variable name should not contain spaces. If a variable name is more than one word, it should be separated with an underscore ($my_string) or with capitalization ($mystring)

18 PHP Variables Scope PHP has three different variable scopes: local global static

19 Local Scope A variable declared within a function has a LOCAL SCOPE and can only be accessed within that function: <?php function mytest() { $x = 5; // local scope echo "<p>variable x inside function is: $x</p>"; } mytest(); // using x outside the function will generate an error echo "<p>variable x outside function is: $x</p>";?>

20 Global Scope A variable declared outside a function has a GLOBAL SCOPE and can only be accessed outside a function: <?php $x = 5; // global scope function mytest() { // using x inside this function will generate an error echo "<p>variable x inside function is: $x</p>"; } mytest(); echo "<p>variable x outside function is: $x</p>";?>

21 PHP The global Keyword The global keyword is used to access a global variable from within a function. <?php $x = 5; $y = 10; function mytest() { global $x, $y; $y = $x + $y; } mytest(); echo $y; // outputs 15?>

22 Global Variables PHP also stores all global variables in an array called $GLOBALS[index]. The index holds the name of the variable. <?php $x = 5; $y = 10; function mytest() { $GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y']; } mytest(); echo $y; // outputs 15?>

23 PHP The static Keyword Normally, when a function is completed/executed, all of its variables are deleted. However, sometimes we want a local variable NOT to be deleted. We need it for a further job. <?php function mytest() { static $x = 0; echo $x; $x++; } mytest(); mytest(); mytest();?>

24 PHP Concatenation > The concatenation operator (.) is used to put two string values together. > To concatenate two string variables together, use the concatenation operator:

25 PHP Concatenation The output of the code on the last slide will be: If we look at the code you see that we used the concatenation operator two times. This is because we had to insert a third string (a space character), to separate the two strings.

26 PHP Operators Operators are used to operate on values. There are four classifications of operators: > Arithmetic > Assignment > Comparison > Logical

27 PHP Operators

28 PHP Operators

29 PHP Operators

30 PHP Operators

31 PHP Conditional Statements > Very often when you write code, you want to perform different actions for different decisions. > You can use conditional statements in your code to do this. > In PHP we have the following conditional statements...

32 PHP Conditional Statements > if statement - use this statement to execute some code only if a specified condition is true > if...else statement - use this statement to execute some code if a condition is true and another code if the condition is false > if...elseif...else statement - use this statement to select one of several blocks of code to be executed > switch statement - use this statement to select one of many blocks of code to be executed

33 PHP Conditional Statements The following example will output "Have a nice weekend!" if the current day is Friday:

34 PHP Conditional Statements Use the if...else statement to execute some code if a condition is true and another code if a condition is false.

35 PHP Conditional Statements If more than one line should be executed if a condition is true/false, the lines should be enclosed within curly braces { }

36 PHP Conditional Statements The following example will output "Have a nice weekend!" if the current day is Friday, and "Have a nice Sunday!" if the current day is Sunday. Otherwise it will output "Have a nice day!":

37 PHP Conditional Statements Use the switch statement to select one of many blocks of code to be executed.

38 PHP Conditional Statements For switches, first we have a single expression n (most often a variable), that is evaluated once. The value of the expression is then compared with the values for each case in the structure. If there is a match, the block of code associated with that case is executed. Use break to prevent the code from running into the next case automatically. The default statement is used if no match is found.

39 PHP Conditional Statements

40 PHP Arrays > An array variable is a storage area holding a number or text. The problem is, a variable will hold only one value. > An array is a special variable, which can store multiple values in one single variable.

41 PHP Arrays If you have a list of items (a list of car names, for example), storing the cars in single variables could look like this:

42 PHP Arrays > However, what if you want to loop through the cars and find a specific one? And what if you had not 3 cars, but 300? > The best solution here is to use an array. > An array can hold all your variable values under a single name. And you can access the values by referring to the array name. > Each element in the array has its own index so that it can be easily accessed.

43 PHP Arrays In PHP, there are three kind of arrays: > Numeric array - An array with a numeric index > Associative array - An array where each ID key is associated with a value > Multidimensional array - An array containing one or more arrays

44 PHP Numeric Arrays > A numeric array stores each array element with a numeric index. > There are two methods to create a numeric array.

45 PHP Numeric Arrays In the following example the index is automatically assigned (the index starts at 0): In the following example we assign the index manually:

46 PHP Numeric Arrays In the following example you access the variable values by referring to the array name and index: The code above will output:

47 PHP Associative Arrays > With an associative array, each ID key is associated with a value. > When storing data about specific named values, a numerical array is not always the best way to do it. > With associative arrays we can use the values as keys and assign values to them.

48 PHP Associative Arrays In this example we use an array to assign ages to the different persons: This example is the same as the one above, but shows a different way of creating the array:

49 PHP Associative Arrays

50 PHP Multidimensional Arrays In a multidimensional array, each element in the main array can also be an array. And each element in the sub-array can be an array, and so on.

51 PHP Multidimensional Arrays

52 PHP Multidimensional Arrays

53 PHP Multidimensional Arrays

54 PHP Loops > Often when you write code, you want the same block of code to run over and over again in a row. Instead of adding several almost equal lines in a script we can use loops to perform a task like this. > In PHP, we have the following looping statements:

55 PHP Loops > while - loops through a block of code while a specified condition is true > do...while - loops through a block of code once, and then repeats the loop as long as a specified condition is true > for - loops through a block of code a specified number of times > foreach - loops through a block of code for each element in an array

56 PHP Loops - While The while loop executes a block of code while a condition is true. The example below defines a loop that starts with i=1. The loop will continue to run as long as i is less than, or equal to 5. i will increase by 1 each time the loop runs:

57 PHP Loops - While

58 PHP Loops Do... While The do...while statement will always execute the block of code once, it will then check the condition, and repeat the loop while the condition is true. The next example defines a loop that starts with i=1. It will then increment i with 1, and write some output. Then the condition is checked, and the loop will continue to run as long as i is less than, or equal to 5:

59 PHP Loops Do... While

60 PHP Loops Do... While

61 PHP Loops - For

62 PHP Loops - For Parameters: > init: Mostly used to set a counter (but can be any code to be executed once at the beginning of the loop) > condition: Evaluated for each loop iteration. If it evaluates to TRUE, the loop continues. If it evaluates to FALSE, the loop ends. > increment: Mostly used to increment a counter (but can be any code to be executed at the end of the loop)

63 PHP Loops - For The example below defines a loop that starts with i=1. The loop will continue to run as long as i is less than, or equal to 5. i will increase by 1 each time the loop runs:

64 PHP Loops - For

65 PHP Loops - Foreach For every loop iteration, the value of the current array element is assigned to $value (and the array pointer is moved by one) - so on the next loop iteration, you'll be looking at the next array value.

66 PHP Loops - Foreach The following example demonstrates a loop that will print the values of the given array:

67 PHP Loops - Foreach

68 PHP Functions > We will now explore how to create your own functions. > To keep the script from being executed when the page loads, you can put it into a function. > A function will be executed by a call to the function. > You may call a function from anywhere within a page.

69 PHP Functions A function will be executed by a call to the function. > Give the function a name that reflects what the function does > The function name can start with a letter or underscore (not a number)

70 PHP Functions A simple function that writes a name when it is called:

71 PHP Functions - Parameters Adding parameters... > To add more functionality to a function, we can add parameters. A parameter is just like a variable. > Parameters are specified after the function name, inside the parentheses.

72 PHP Functions - Parameters

73 PHP Functions - Parameters

74 PHP Functions - Parameters This example adds different punctuation.

75 PHP Functions - Parameters

76 PHP Default Argument Value If we call the function setheight() without arguments it takes the default value as argument: <?php function setheight($minheight = 50) { echo "The height is : $minheight <br>"; } setheight(350); setheight(); // will use the default value of 50 setheight(135); setheight(80);?>

77 PHP Functions - Returning values To let a function return a value, use the return statement: <?php function sum($x, $y) { $z = $x + $y; return $z; } echo " = ". sum(5, 10). "<br>"; echo " = ". sum(7, 13). "<br>"; echo "2 + 4 = ". sum(2, 4);?>

78 PHP Global Variables - Superglobals Several predefined variables in PHP are "superglobals", which means that they are always accessible, regardless of scope - and you can access them from any function, class or file without having to do anything special.

79 PHP superglobal variables The PHP superglobal variables are: $GLOBALS $_SERVER $_REQUEST $_POST $_GET $_FILES $_ENV $_COOKIE $_SESSION

80 PHP $GLOBALS $GLOBALS is a PHP super global variable which is used to access global variables from anywhere in the PHP script (also from within functions or methods). PHP stores all global variables in an array called $GLOBALS[index]. The index holds the name of the variable.

81 PHP $GLOBALS Example <?php $x = 75; $y = 25; function addition() { $GLOBALS['z'] = $GLOBALS['x'] + $GLOBALS['y']; } addition(); echo $z;?>

82 PHP $_SERVER $_SERVER is a PHP super global variable which holds information about headers, paths, and script locations. <?php echo $_SERVER['PHP_SELF']; echo "<br>"; echo $_SERVER['SERVER_NAME']; echo "<br>"; echo $_SERVER['HTTP_HOST']; echo "<br>"; echo $_SERVER['SCRIPT_NAME'];?>

83 The following table lists the most important elements that can go inside $_SERVER: Element/Code $_SERVER['PHP_SELF'] $_SERVER['SCRIPT_FILENAME'] $_SERVER['SERVER_ADDR'] Description Returns the filename of the currently executing script Returns the absolute pathname of the currently executing script Returns the IP address of the host server $_SERVER['SERVER_NAME'] Returns the name of the host server $_SERVER['SERVER_SOFTWARE'] $_SERVER['SERVER_PROTOCOL'] $_SERVER['REQUEST_METHOD'] Returns the server identification string (such as Apache/2.2.24) Returns the name and revision of the information protocol (such as HTTP/1.1) Returns the request method used to access the page (such as POST)

84 PHP Forms - $_GET Function > The built-in $_GET function is used to collect values from a form sent with method="get". > Information sent from a form with the GET method is visible to everyone (it will be displayed in the browser's address bar) and has limits on the amount of information to send (max. 100 characters).

85 PHP Forms - $_GET Function Notice how the URL carries the information after the file name.

86 PHP Forms - $_GET Function The "welcome.php" file can now use the $_GET function to collect form data (the names of the form fields will automatically be the keys in the $_GET array)

87 PHP Forms - $_GET Function > When using method="get" in HTML forms, all variable names and values are displayed in the URL. > This method should not be used when sending passwords or other sensitive information! > However, because the variables are displayed in the URL, it is possible to bookmark the page. This can be useful in some cases. > The get method is not suitable for large variable values; the value cannot exceed 100 chars.

88 PHP Forms - $_POST Function > The built-in $_POST function is used to collect values from a form sent with method="post". > Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send. > Note: However, there is an 8 Mb max size for the POST method, by default (can be changed by setting the post_max_size in the php.ini file).

89 PHP Forms - $_POST Function And here is what the code of action.php might look like:

90 PHP Forms - $_POST Function Apart from htmlspecialchars() and (int), it should be obvious what this does. htmlspecialchars() makes sure any characters that are special in html are properly encoded so people can't inject HTML tags or Javascript into your page. For the age field, since we know it is a number, we can just convert it to an integer which will automatically get rid of any stray characters. The $_POST['name'] and $_POST['age'] variables are automatically set for you by PHP.

91 PHP Forms - $_POST Function When to use method="post"? > Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send. > However, because the variables are not displayed in the URL, it is not possible to bookmark the page.

92 PHP Form Validation

93 The Form Element The HTML code of the form looks like this: <form method="post" action="<?php echo htmlspecialchars($_server["php_self"]);?>">

94 PHP Form Validation $_SERVER["PHP_SELF"] variable? The $_SERVER["PHP_SELF"] is a super global variable that returns the filename of the currently executing script. htmlspecialchars() function? The htmlspecialchars() function converts special characters to HTML entities. This means that it will replace HTML characters like < and > with < and >. This prevents attackers from exploiting the code by injecting HTML or Javascript code (Cross-site Scripting attacks) in forms.

95 REQUIRED FIELD if (empty($_post["name"])) { $nameerr = "Name is required"; } else { $name = $_POST["name"]; } DISPLAY ERROR MESSAGE <form method="post" action="<?php echo htmlspecialchars($_server["php_self"]);?> "> Name: <input type="text" name="name"> <span class="error">* <?php echo $nameerr;?></span><br>

96 PHP - Validate Name $name = $_POST["name"]; if (!preg_match("/^[a-za-z ]*$/",$name)) { $nameerr = "Only letters and white space allowed"; } The preg_match() function searches a string for pattern, returning true if the pattern exists, and false otherwise.

97 PHP - Validate $ = $_POST[" "]; if (!filter_var($ , FILTER_VALIDATE_ )) { $ err = "Invalid format"; } The easiest and safest way to check whether an address is well-formed is to use PHP's filter_var() function.

98 PHP - Validate URL The code below shows a way to check if a URL address syntax is valid (this regular expression also allows dashes in the URL). $website = $_POST["website"]; if (!preg_match("/\b(?:(?:https? ftp):\/\/ www\.)[- a-z0-9+&@#\/%?=~_!:,.;]*[-a-z0-9+&@#\/%=~_ ]/i",$website)) { $websiteerr = "Invalid URL"; }

99 PHP And MySQL MySQL is the most popular open-source database system.

100 Connecting to Database Create a Connection to a MySQL Database -Before you can access data in a database, you must create a connection to the - database. -In PHP, this is done with the mysql_connect() function. Syntax mysql_connect(servername,username,password); Parameter servername username Description Optional. Specifies the server to connect to. Default value is "localhost:3306" Optional. Specifies the username to log in with. Default value is the name of the user that owns the server process password Optional. Specifies the password to log in with. Default is ""

101 Establishing and Closing the connection <?php $con = mysql_connect("localhost","peter","abc123"); if (!$con) { die('could not connect: '. mysql_error()); } // some code mysql_close($con);?> die - Output a message and terminate the current script

102 Create a Database The CREATE DATABASE statement is used to create a database in MySQL. Syntax CREATE DATABASE database_name To get PHP to execute the statement above we must use the mysql_query() function. This function is used to send a query or command to a MySQL connection.

103 mysql_close($con);?> Create a Database <?php $con = mysql_connect("localhost","peter","abc123"); if (!$con) { die('could not connect: '. mysql_error()); } if (mysql_query("create DATABASE my_db",$con)) { echo "Database created"; } else { echo "Error creating database: ". mysql_error(); }

104 <?php Create a Table //Create database mysql_select_db("my_db", $con);//select database //create table $sql = "CREATE TABLE Persons ( FirstName varchar(15), LastName varchar(15), Age int )"; mysql_query($sql,$con); // Execute query mysql_close($con); // Close Connection

105 Insert Data Into a Database Table <?php $con = mysql_connect("localhost","peter","abc123"); if (!$con) { die('could not connect: '. mysql_error()); }

106 Insert Data Into a Database Table mysql_select_db("my_db", $con); mysql_query("insert INTO Persons (FirstName, LastName, Age) VALUES ('Peter', 'Griffin', 35)"); mysql_query("insert INTO Persons (FirstName, LastName, Age) VALUES ('Glenn', 'Quagmire', 23)"); mysql_close($con);?>

107 Insert Data From a Form Into a HTML form: Database <html> <body> <form action="insert.php" method="post"> Firstname: <input type="text" name="firstname" /> Lastname: <input type="text" name="lastname" /> Age: <input type="text" name="age" /> <input type="submit" /> </form> </body> </html>

108 Insert Data From a Form Into a "insert.php" page: Database <?php $con = mysql_connect("localhost","peter","abc123"); if (!$con) { die('could not connect: '. mysql_error()); } mysql_select_db("my_db", $con);

109 Insert Data From a Form Into a Database $sql="insert INTO Persons (FirstName, LastName, Age) VALUES ('$_POST[firstname]','$_POST[lastname]', $_POST[age])"; if (!mysql_query($sql,$con)) { die('error: '. mysql_error()); } mysql_close($con)?>

110 Select Data From a Database Table <?php $con = mysql_connect("localhost","peter","abc123"); if (!$con) { die('could not connect: '. mysql_error()); } mysql_select_db("my_db", $con);

111 Select Data From a Database Table $result = mysql_query("select * FROM Persons"); while($row = mysql_fetch_array($result)) { echo $row['firstname']. " ". $row['lastname']; echo "<br />"; } mysql_close($con);?>

112 Explanation - The example stores the data returned by the mysql_query() function in the $result variable. - mysql_fetch_array Fetch a result row as an associative array, a numeric array, or both - Next, we use the mysql_fetch_array() function to return the first row from the recordset as an array. Each call to mysql_fetch_array() returns the next row in the recordset. The while loop loops through all the records in the recordset.

PHP. M hiwa ahamad aziz Raparin univercity. 1 Web Design: Lecturer ( m hiwa ahmad aziz)

PHP. M hiwa ahamad aziz  Raparin univercity. 1 Web Design: Lecturer ( m hiwa ahmad aziz) PHP M hiwa ahamad aziz www.raparinweb.com Raparin univercity 1 Server-Side Programming language asp, asp.net, php, jsp, perl, cgi... 2 Of 68 Client-Side Scripting versus Server-Side Scripting Client-side

More information

What is PHP? [1] Figure 1 [1]

What is PHP? [1] Figure 1 [1] PHP What is PHP? [1] PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP is free to download and use Figure

More information

What is MySQL? [Document provides the fundamental operations of PHP-MySQL connectivity]

What is MySQL? [Document provides the fundamental operations of PHP-MySQL connectivity] What is MySQL? [Document provides the fundamental operations of PHP-MySQL connectivity] MySQL is a database. A database defines a structure for storing information. In a database, there are tables. Just

More information

PHP Development - Introduction

PHP Development - Introduction PHP Development - Introduction Php Hypertext Processor PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports many

More information

Let's Look Back. We talked about how to create a form in HTML. Forms are one way to interact with users

Let's Look Back. We talked about how to create a form in HTML. Forms are one way to interact with users Introduction to PHP Let's Look Back We talked about how to create a form in HTML Forms are one way to interact with users Users can enter information into forms which can be used by you (programmer) We

More information

PHP 5 if...else...elseif Statements

PHP 5 if...else...elseif Statements PHP 5 if...else...elseif Statements Conditional statements are used to perform different actions based on different conditions. PHP Conditional Statements Very often when you write code, you want to perform

More information

Chapter 7:- PHP. Compiled By:- Sanjay Patel Assistant Professor, SVBIT.

Chapter 7:- PHP. Compiled By:- Sanjay Patel Assistant Professor, SVBIT. Chapter 7:- PHP Compiled By:- Assistant Professor, SVBIT. Outline Starting to script on server side, Arrays, Function and forms, Advance PHP Databases:-Basic command with PHP examples, Connection to server,

More information

PHP INTERVIEW QUESTION-ANSWERS

PHP INTERVIEW QUESTION-ANSWERS 1. What is PHP? PHP (recursive acronym for PHP: Hypertext Preprocessor) is the most widely used open source scripting language, majorly used for web-development and application development and can be embedded

More information

PHP 5 Introduction. What You Should Already Know. What is PHP? What is a PHP File? What Can PHP Do? Why PHP?

PHP 5 Introduction. What You Should Already Know. What is PHP? What is a PHP File? What Can PHP Do? Why PHP? PHP 5 Introduction What You Should Already Know you should have a basic understanding of the following: HTML CSS What is PHP? PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open

More information

php Mr. Amit Patel Hypertext Preprocessor Dept. of I.T.

php Mr. Amit Patel Hypertext Preprocessor Dept. of I.T. php Hypertext Preprocessor Mr. Amit Patel Dept. of I.T..com.com PHP files can contain text, HTML, JavaScript code, and PHP code PHP code are executed on the server, and the result is returned to the browser

More information

PHP by Pearson Education, Inc. All Rights Reserved.

PHP by Pearson Education, Inc. All Rights Reserved. PHP 1992-2012 by Pearson Education, Inc. All Client-side Languages User-agent (web browser) requests a web page JavaScript is executed on PC http request Can affect the Browser and the page itself http

More information

Princess Nourah bint Abdulrahman University. Computer Sciences Department

Princess Nourah bint Abdulrahman University. Computer Sciences Department Princess Nourah bint Abdulrahman University Computer Sciences Department 1 And use http://www.w3schools.com/ PHP Part 1 Objectives Introduction to PHP Computer Sciences Department 4 Introduction HTML CSS

More information

Princess Nourah bint Abdulrahman University. Computer Sciences Department

Princess Nourah bint Abdulrahman University. Computer Sciences Department Princess Nourah bint Abdulrahman University Computer Sciences Department 1 And use http://www.w3schools.com/ PHP Part 3 Objectives Creating a new MySQL Database using Create & Check connection with Database

More information

PHP. Introduction. PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server

PHP. Introduction. PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP Introduction Hypertext Preprocessor is a widely used, general-purpose scripting language that was originally designed for web development to produce dynamic web pages. For this purpose, PHP code is

More information

The PHP language. Teaching you everything about PHP? Not exactly Goal: teach you how to interact with a database via web

The PHP language. Teaching you everything about PHP? Not exactly Goal: teach you how to interact with a database via web Web programming The PHP language Our objective Teaching you everything about PHP? Not exactly Goal: teach you how to interact with a database via web Access data inserted by users into HTML forms Interact

More information

Chapter 6 Part2: Manipulating MySQL Databases with PHP

Chapter 6 Part2: Manipulating MySQL Databases with PHP IT215 Web Programming 1 Chapter 6 Part2: Manipulating MySQL Databases with PHP Jakkrit TeCho, Ph.D. Business Information Technology (BIT), Maejo University Phrae Campus Objectives In this chapter, you

More information

Important Points about PHP:

Important Points about PHP: Important Points about PHP: PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language that is embedded in HTML. It is used to manage dynamic content, databases, session tracking,

More information

PHP for PL/SQL Developers. Lewis Cunningham JP Morgan Chase

PHP for PL/SQL Developers. Lewis Cunningham JP Morgan Chase PHP for PL/SQL Developers Lewis Cunningham JP Morgan Chase 1 What is PHP? PHP is a HTML pre-processor PHP allows you to generate HTML dynamically PHP is a scripting language usable on the web, the server

More information

Web Engineering (Lecture 08) WAMP

Web Engineering (Lecture 08) WAMP Web Engineering (Lecture 08) WAMP By: Mr. Sadiq Shah Lecturer (CS) Class BS(IT)-6 th semester WAMP WAMP is all-in-one Apache/MySQL/PHP package WAMP stands for: i) Windows ii) iii) iv) Apache MySql PHP

More information

A QUICK GUIDE TO PROGRAMMING FOR THE WEB. ssh (then type your UBIT password when prompted)

A QUICK GUIDE TO PROGRAMMING FOR THE WEB. ssh (then type your UBIT password when prompted) A QUICK GUIDE TO PROGRAMMING FOR THE WEB TO GET ACCESS TO THE SERVER: ssh Secure- Shell. A command- line program that allows you to log in to a server and access your files there as you would on your own

More information

Hello everyone! Page 1. Your folder should look like this. To start with Run your XAMPP app and start your Apache and MySQL.

Hello everyone! Page 1. Your folder should look like this. To start with Run your XAMPP app and start your Apache and MySQL. Hello everyone! Welcome to our PHP + MySQL (Easy to learn) E.T.L. free online course Hope you have installed your XAMPP? And you have created your forms inside the studio file in the htdocs folder using

More information

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Introduction: PHP (Hypertext Preprocessor) was invented by Rasmus Lerdorf in 1994. First it was known as Personal Home Page. Later

More information

Database Connectivity using PHP Some Points to Remember:

Database Connectivity using PHP Some Points to Remember: Database Connectivity using PHP Some Points to Remember: 1. PHP has a boolean datatype which can have 2 values: true or false. However, in PHP, the number 0 (zero) is also considered as equivalent to False.

More information

B. V. Patel Institute of BMC & IT 2014

B. V. Patel Institute of BMC & IT 2014 Unit 1: Introduction Short Questions: 1. What are the rules for writing PHP code block? 2. Explain comments in your program. What is the purpose of comments in your program. 3. How to declare and use constants

More information

More loops. Control structures / flow control. while loops. Loops / Iteration / doing things over and over and over and over...

More loops. Control structures / flow control. while loops. Loops / Iteration / doing things over and over and over and over... Control structures / flow control More loops while loops if... else Switch for loops while... do.. do... while... Much of this material is explained in PHP programming 2nd Ed. Chap 2 Control structures

More information

Introduction of PHP Created By: Umar Farooque Khan

Introduction of PHP Created By: Umar Farooque Khan 1 Introduction of PHP Created By: Umar Farooque Khan 2 What is PHP? PHP stand for hypertext pre-processor. PHP is a general purpose server side scripting language that is basically used for web development.

More information

COM1004 Web and Internet Technology

COM1004 Web and Internet Technology COM1004 Web and Internet Technology When a user submits a web form, how do we save the information to a database? How do we retrieve that data later? ID NAME EMAIL MESSAGE TIMESTAMP 1 Mike mike@dcs Hi

More information

By the end of this section of the practical, the students should be able to:

By the end of this section of the practical, the students should be able to: By the end of this section of the practical, the students should be able to: Connecting to a MySQL database in PHP with the mysql_connect() and mysql_select_db() functions Trapping and displaying database

More information

PHP with data handling

PHP with data handling 171 Lesson 18 PHP with data handling Aim Objectives : To provide an introduction data handling with PHP : To give an idea about, What type of data you need to handle? How PHP handle the form data? 18.1

More information

Course Topics. The Three-Tier Architecture. Example 1: Airline reservations. IT360: Applied Database Systems. Introduction to PHP

Course Topics. The Three-Tier Architecture. Example 1: Airline reservations. IT360: Applied Database Systems. Introduction to PHP Course Topics IT360: Applied Database Systems Introduction to PHP Database design Relational model SQL Normalization PHP MySQL Database administration Transaction Processing Data Storage and Indexing The

More information

PHP. MIT 6.470, IAP 2010 Yafim Landa

PHP. MIT 6.470, IAP 2010 Yafim Landa PHP MIT 6.470, IAP 2010 Yafim Landa (landa@mit.edu) LAMP We ll use Linux, Apache, MySQL, and PHP for this course There are alternatives Windows with IIS and ASP Java with Tomcat Other database systems

More information

CERTIFICATE IN WEB PROGRAMMING

CERTIFICATE IN WEB PROGRAMMING COURSE DURATION: 6 MONTHS CONTENTS : CERTIFICATE IN WEB PROGRAMMING 1. PROGRAMMING IN C and C++ Language 2. HTML/CSS and JavaScript 3. PHP and MySQL 4. Project on Development of Web Application 1. PROGRAMMING

More information

Course Topics. IT360: Applied Database Systems. Introduction to PHP

Course Topics. IT360: Applied Database Systems. Introduction to PHP IT360: Applied Database Systems Introduction to PHP Chapter 1 and Chapter 6 in "PHP and MySQL Web Development" Course Topics Relational model SQL Database design Normalization PHP MySQL Database administration

More information

Course Syllabus. Course Title. Who should attend? Course Description. PHP ( Level 1 (

Course Syllabus. Course Title. Who should attend? Course Description. PHP ( Level 1 ( Course Title PHP ( Level 1 ( Course Description PHP '' Hypertext Preprocessor" is the most famous server-side programming language in the world. It is used to create a dynamic website and it supports many

More information

Distributed Databases and Remote Access to a Database

Distributed Databases and Remote Access to a Database Distributed Databases and Remote Access to a Database Table of Contents 1 Distributed Databases... 2 2 Internet (Overview)... 4 3 Internet-Based Applications... 9 3.1 Server-Side Scripting... 9 3.2 Client-Side

More information

Server side scripting and databases

Server side scripting and databases Example table Server side scripting and databases student How Web Applications interact with server side databases - part 2 student kuid lastname money char char int student table Connecting and using

More information

PHP Reference. To access MySQL manually, run the following command on the machine, called Sources, where MySQL and PhP have been installed:

PHP Reference. To access MySQL manually, run the following command on the machine, called Sources, where MySQL and PhP have been installed: PHP Reference 1 Preface This tutorial is designed to teach you all the PHP commands and constructs you need to complete your PHP project assignment. It is assumed that you have never programmed in PHP

More information

CSC Web Programming. Introduction to JavaScript

CSC Web Programming. Introduction to JavaScript CSC 242 - Web Programming Introduction to JavaScript JavaScript JavaScript is a client-side scripting language the code is executed by the web browser JavaScript is an embedded language it relies on its

More information

Arithmetic and Assignment Operators

Arithmetic and Assignment Operators PHP - Part 2 More operators... Arithmetic and Assignment Operators e.g., using + and = $IntA=5; $intb=8; $intc=$inta+$intb; //intc is 13 // Same +, -, *, / and % as C $inta + = $intb; //as in C Bitwise:

More information

PHP Hypertext Preprocessor

PHP Hypertext Preprocessor PHP Hypertext Preprocessor A brief survey Stefano Fontanelli stefano.fontanelli@sssup.it January 16, 2009 Stefano Fontanelli stefano.fontanelli@sssup.it PHP Hypertext Preprocessor January 16, 2009 1 /

More information

Chapter 2: Functions and Control Structures

Chapter 2: Functions and Control Structures Chapter 2: Functions and Control Structures TRUE/FALSE 1. A function definition contains the lines of code that make up a function. T PTS: 1 REF: 75 2. Functions are placed within parentheses that follow

More information

This is CS50. Harvard College Fall Quiz 1 Answer Key

This is CS50. Harvard College Fall Quiz 1 Answer Key Quiz 1 Answer Key Answers other than the below may be possible. Know Your Meme. 0. True or False. 1. T 2. F 3. F 4. F 5. T Attack. 6. By never making assumptions as to the length of users input and always

More information

PHP Tutorial 6(a) Using PHP with MySQL

PHP Tutorial 6(a) Using PHP with MySQL Objectives After completing this tutorial, the student should have learned; The basic in calling MySQL from PHP How to display data from MySQL using PHP How to insert data into MySQL using PHP Faculty

More information

IELM 511 Information Systems Design Labs 5 and 6. DB creation and Population

IELM 511 Information Systems Design Labs 5 and 6. DB creation and Population IELM 511 Information Systems Design Labs 5 and 6. DB creation and Population In this lab, your objective is to learn the basics of creating and managing a DB system. One way to interact with the DBMS (MySQL)

More information

PHP 1. Introduction Temasek Polytechnic

PHP 1. Introduction Temasek Polytechnic PHP 1 Introduction Temasek Polytechnic Background Open Source Apache License Free to redistribute with/without source code http://www.apache.org/license.txt Backed by Zend Corporation http://www.zend.com

More information

Form Processing in PHP

Form Processing in PHP Form Processing in PHP Forms Forms are special components which allow your site visitors to supply various information on the HTML page. We have previously talked about creating HTML forms. Forms typically

More information

<form>. input elements. </form>

<form>. input elements. </form> CS 183 4/8/2010 A form is an area that can contain form elements. Form elements are elements that allow the user to enter information (like text fields, text area fields, drop-down menus, radio buttons,

More information

Databases on the web

Databases on the web Databases on the web The Web Application Stack Network Server You The Web Application Stack Network Server You The Web Application Stack Web Browser Network Server You The Web Application Stack Web Browser

More information

Lecture 7: Web hacking 3, SQL injection, Xpath injection, Server side template injection, File inclusion

Lecture 7: Web hacking 3, SQL injection, Xpath injection, Server side template injection, File inclusion IN5290 Ethical Hacking Lecture 7: Web hacking 3, SQL injection, Xpath injection, Server side template injection, File inclusion Universitetet i Oslo Laszlo Erdödi Lecture Overview What is SQL injection

More information

PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008.

PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008. PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008. Outline. How cookies work. Cookies in PHP. Sessions. Databases. Cookies. Sometimes it is useful to remember a client when it comes

More information

Web Programming. Dr Walid M. Aly. Lecture 10 PHP. lec10. Web Programming CS433/CS614 22:32. Dr Walid M. Aly

Web Programming. Dr Walid M. Aly. Lecture 10 PHP. lec10. Web Programming CS433/CS614 22:32. Dr Walid M. Aly Web Programming Lecture 10 PHP 1 Purpose of Server-Side Scripting database access Web page can serve as front-end to a database Ømake requests from browser, Øpassed on to Web server, Øcalls a program to

More information

I n p u t. This time. Security. Software. sanitization ); drop table slides. Continuing with. Getting insane with. New attacks and countermeasures:

I n p u t. This time. Security. Software. sanitization ); drop table slides. Continuing with. Getting insane with. New attacks and countermeasures: This time Continuing with Software Security Getting insane with I n p u t sanitization ); drop table slides New attacks and countermeasures: SQL injection Background on web architectures A very basic web

More information

Princess Nourah bint Abdulrahman University. Computer Sciences Department

Princess Nourah bint Abdulrahman University. Computer Sciences Department Princess Nourah bint Abdulrahman University 1 And use http://www.w3schools.com/ JavaScript Objectives Introduction to JavaScript Objects Data Variables Operators Types Functions Events 4 Why Study JavaScript?

More information

PHP can also increase your productivity enormously, both in development time and maintenance time.

PHP can also increase your productivity enormously, both in development time and maintenance time. 4.0 Introduction to stands for Hypertext Processor A recursive definition!. was originally created by Rasmus Lerdorf in 1995. The main implementation of is now produced by The Group and serves as the formal

More information

PHP and MySQL for Dynamic Web Sites. Intro Ed Crowley

PHP and MySQL for Dynamic Web Sites. Intro Ed Crowley PHP and MySQL for Dynamic Web Sites Intro Ed Crowley Class Preparation If you haven t already, download the sample scripts from: http://www.larryullman.com/books/phpand-mysql-for-dynamic-web-sitesvisual-quickpro-guide-4thedition/#downloads

More information

CPSC 481: CREATIVE INQUIRY TO WSBF

CPSC 481: CREATIVE INQUIRY TO WSBF CPSC 481: CREATIVE INQUIRY TO WSBF J. Yates Monteith, Fall 2013 Schedule HTML and CSS PHP HTML Hypertext Markup Language Markup Language. Does not execute any computation. Marks up text. Decorates it.

More information

Activity 1.1: Indexed Arrays in PHP

Activity 1.1: Indexed Arrays in PHP Name: StudentID: Note: Please fill the online CES feedback for this course if you have not done so. We value your feedback and it helps us to improve the course. Note: All of you should be familiar with

More information

JavaScript Functions, Objects and Array

JavaScript Functions, Objects and Array JavaScript Functions, Objects and Array Defining a Function A definition starts with the word function. A name follows that must start with a letter or underscore, followed by any number of letters, digits,

More information

Create Basic Databases and Integrate with a Website Lesson 3

Create Basic Databases and Integrate with a Website Lesson 3 Create Basic Databases and Integrate with a Website Lesson 3 Combining PHP and MySQL This lesson presumes you have covered the basics of PHP as well as working with MySQL. Now you re ready to make the

More information

BEGINNER PHP Table of Contents

BEGINNER PHP Table of Contents Table of Contents 4 5 6 7 8 9 0 Introduction Getting Setup Your first PHP webpage Working with text Talking to the user Comparison & If statements If & Else Cleaning up the game Remembering values Finishing

More information

HTML 5 Form Processing

HTML 5 Form Processing HTML 5 Form Processing In this session we will explore the way that data is passed from an HTML 5 form to a form processor and back again. We are going to start by looking at the functionality of part

More information

CGS 3066: Spring 2015 JavaScript Reference

CGS 3066: Spring 2015 JavaScript Reference CGS 3066: Spring 2015 JavaScript Reference Can also be used as a study guide. Only covers topics discussed in class. 1 Introduction JavaScript is a scripting language produced by Netscape for use within

More information

Flow Control. Copyleft 2005, Binnur Kurt

Flow Control. Copyleft 2005, Binnur Kurt 10 Flow Control Copyleft 2005, Binnur Kurt Content if, if/else, switch for, while, do/while 513 Conditional Statements Very often when you write code, you want to perform different actions for different

More information

1/22/2017. Chapter 2. Functions and Control Structures. Calling Functions. Objectives. Defining Functions (continued) Defining Functions

1/22/2017. Chapter 2. Functions and Control Structures. Calling Functions. Objectives. Defining Functions (continued) Defining Functions Chapter 2 Functions and Control Structures PHP Programming with MySQL 2 nd Edition Objectives In this chapter, you will: Study how to use functions to organize your PHP code Learn about variable scope

More information

Server side basics CS380

Server side basics CS380 1 Server side basics URLs and web servers 2 http://server/path/file Usually when you type a URL in your browser: Your computer looks up the server's IP address using DNS Your browser connects to that IP

More information

JavaScript s role on the Web

JavaScript s role on the Web Chris Panayiotou JavaScript s role on the Web JavaScript Programming Language Developed by Netscape for use in Navigator Web Browsers Purpose make web pages (documents) more dynamic and interactive Change

More information

CHAPTER 10. Connecting to Databases within PHP

CHAPTER 10. Connecting to Databases within PHP CHAPTER 10 Connecting to Databases within PHP CHAPTER OBJECTIVES Get a connection to a MySQL database from within PHP Use a particular database Send a query to the database Parse the query results Check

More information

Web Application Development (WAD) V th Sem BBAITM (Unit 4) By: Binit Patel

Web Application Development (WAD) V th Sem BBAITM (Unit 4) By: Binit Patel Web Application Development (WAD) V th Sem BBAITM (Unit 4) By: Binit Patel Working with Forms: A very popular way to make a web site interactive is using HTML based forms by the site. Using HTML forms,

More information

PHP. How Web Applications interact with server side databases CRUD. Connecting and using mysql from PHP PHP provides many mysql specific functions

PHP. How Web Applications interact with server side databases CRUD. Connecting and using mysql from PHP PHP provides many mysql specific functions PHP How Web Applications interact with server side databases CRUD Connecting and using mysql from PHP PHP provides many mysql specific functions mysql_connect mysql_select_db mysql_query mysql_fetch_array

More information

Computer Components. Software{ User Programs. Operating System. Hardware

Computer Components. Software{ User Programs. Operating System. Hardware Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

More information

WEB SECURITY WORKSHOP TEXSAW Presented by Solomon Boyd and Jiayang Wang

WEB SECURITY WORKSHOP TEXSAW Presented by Solomon Boyd and Jiayang Wang WEB SECURITY WORKSHOP TEXSAW 2014 Presented by Solomon Boyd and Jiayang Wang Introduction and Background Targets Web Applications Web Pages Databases Goals Steal data Gain access to system Bypass authentication

More information

Fachgebiet Technische Informatik, Joachim Zumbrägel

Fachgebiet Technische Informatik, Joachim Zumbrägel Computer Network Lab 2017 Fachgebiet Technische Informatik, Joachim Zumbrägel Overview Internet Internet Protocols Fundamentals about HTTP Communication HTTP-Server, mode of operation Static/Dynamic Webpages

More information

USQ/CSC2406 Web Publishing

USQ/CSC2406 Web Publishing USQ/CSC2406 Web Publishing Lecture 4: HTML Forms, Server & CGI Scripts Tralvex (Rex) Yeap 19 December 2002 Outline Quick Review on Lecture 3 Topic 7: HTML Forms Topic 8: Server & CGI Scripts Class Activity

More information

LAMP Apps. Overview. Learning Outcomes: At the completion of the lab you should be able to:

LAMP Apps. Overview. Learning Outcomes: At the completion of the lab you should be able to: LAMP Apps Overview This lab walks you through using Linux, Apache, MySQL and PHP (LAMP) to create simple, yet very powerful PHP applications connected to a MySQL database. For developers using Windows,

More information

Subject Name: Advanced Web Programming Subject Code: (13MCA43) 1. what is PHP? Discuss different control statements

Subject Name: Advanced Web Programming Subject Code: (13MCA43) 1. what is PHP? Discuss different control statements PES Institute of Technology, Bangalore South Campus (Formerly PES School of Engineering) (Hosur Road, 1KM before Electronic City, Bangalore-560 100) Dept of MCA INTERNAL TEST (SCHEME AND SOLUTION) 2 Subject

More information

Alpha College of Engineering and Technology. Question Bank

Alpha College of Engineering and Technology. Question Bank Alpha College of Engineering and Technology Department of Information Technology and Computer Engineering Chapter 1 WEB Technology (2160708) Question Bank 1. Give the full name of the following acronyms.

More information

Programming for the Web with PHP

Programming for the Web with PHP Aptech Ltd Version 1.0 Page 1 of 11 Table of Contents Aptech Ltd Version 1.0 Page 2 of 11 Abstraction Anonymous Class Apache Arithmetic Operators Array Array Identifier arsort Function Assignment Operators

More information

Web Scripting using PHP

Web Scripting using PHP Web Scripting using PHP Server side scripting No Scripting example - how it works... User on a machine somewhere Server machine So what is a Server Side Scripting Language? Programming language code embedded

More information

CMPS 401 Survey of Programming Languages

CMPS 401 Survey of Programming Languages CMPS 401 Survey of Programming Languages Programming Assignment #4 PHP Language On the Ubuntu Operating System Write a PHP program (P4.php) and create a HTML (P4.html) page under the Ubuntu operating system.

More information

You can also set the expiration time of the cookie in another way. It may be easier than using seconds.

You can also set the expiration time of the cookie in another way. It may be easier than using seconds. What is a Cookie? A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will

More information

CSCB20 Week 8. Introduction to Database and Web Application Programming. Anna Bretscher* Winter 2017

CSCB20 Week 8. Introduction to Database and Web Application Programming. Anna Bretscher* Winter 2017 CSCB20 Week 8 Introduction to Database and Web Application Programming Anna Bretscher* Winter 2017 *thanks to Alan Rosselet for providing the slides these are adapted from. Web Programming We have seen

More information

Developing Online Databases and Serving Biological Research Data

Developing Online Databases and Serving Biological Research Data Developing Online Databases and Serving Biological Research Data 1 Last Time HTML Hypertext Markup Language Used to build web pages Static, and can't change the way it presents itself based off of user

More information

COMP284 Scripting Languages Lecture 11: PHP (Part 3) Handouts

COMP284 Scripting Languages Lecture 11: PHP (Part 3) Handouts COMP284 Scripting Languages Lecture 11: PHP (Part 3) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool

More information

Varargs Training & Software Development Centre Private Limited, Module: HTML5, CSS3 & JavaScript

Varargs Training & Software Development Centre Private Limited, Module: HTML5, CSS3 & JavaScript PHP Curriculum Module: HTML5, CSS3 & JavaScript Introduction to the Web o Explain the evolution of HTML o Explain the page structure used by HTML o List the drawbacks in HTML 4 and XHTML o List the new

More information

Agenda. 1. Brief History of PHP. 2. Getting started. 3. Examples

Agenda. 1. Brief History of PHP. 2. Getting started. 3. Examples PHP An Introduction Agenda 1. Brief History of PHP 2. Getting started 3. Examples Brief History of PHP PHP (PHP: Hypertext Preprocessor) was created by Rasmus Lerdorf in 1994. It was initially developed

More information

3 The Building Blocks: Data Types, Literals, and Variables

3 The Building Blocks: Data Types, Literals, and Variables chapter 3 The Building Blocks: Data Types, Literals, and Variables 3.1 Data Types A program can do many things, including calculations, sorting names, preparing phone lists, displaying images, validating

More information

Lecture 7 PHP Basics. Web Engineering CC 552

Lecture 7 PHP Basics. Web Engineering CC 552 Lecture 7 PHP Basics Web Engineering CC 552 Overview n Overview of PHP n Syntactic Characteristics n Primitives n Output n Control statements n Arrays n Functions n WampServer Origins and uses of PHP n

More information

Introduction. Server-side Techniques. Introduction. 2 modes in the PHP processor:

Introduction. Server-side Techniques. Introduction. 2 modes in the PHP processor: Introduction Server-side Techniques PHP Hypertext Processor A very popular server side language on web Code embedded directly into HTML documents http://hk2.php.net/downloads.php Features Free, open source

More information

LECTURE 5 Control Structures Part 2

LECTURE 5 Control Structures Part 2 LECTURE 5 Control Structures Part 2 REPETITION STATEMENTS Repetition statements are called loops, and are used to repeat the same code multiple times in succession. The number of repetitions is based on

More information

ITS331 IT Laboratory I: (Laboratory #11) Session Handling

ITS331 IT Laboratory I: (Laboratory #11) Session Handling School of Information and Computer Technology Sirindhorn International Institute of Technology Thammasat University ITS331 Information Technology Laboratory I Laboratory #11: Session Handling Creating

More information

Web Focused Programming With PHP

Web Focused Programming With PHP Web Focused Programming With PHP May 20 2014 Thomas Beebe Advanced DataTools Corp (tom@advancedatatools.com) Tom Beebe Tom is a Senior Database Consultant and has been with Advanced DataTools for over

More information

PHP. Interactive Web Systems

PHP. Interactive Web Systems PHP Interactive Web Systems PHP PHP is an open-source server side scripting language. PHP stands for PHP: Hypertext Preprocessor One of the most popular server side languages Second most popular on GitHub

More information

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG 1 Notice Class Website http://www.cs.umb.edu/~jane/cs114/ Reading Assignment Chapter 1: Introduction to Java Programming

More information

Binghamton University. CS-211 Fall Syntax. What the Compiler needs to understand your program

Binghamton University. CS-211 Fall Syntax. What the Compiler needs to understand your program Syntax What the Compiler needs to understand your program 1 Pre-Processing Any line that starts with # is a pre-processor directive Pre-processor consumes that entire line Possibly replacing it with other

More information

CS Homework 6. Deadline. Purpose. How to submit. Important notes. Problem 1. Spring CS Homework 6 p. 1

CS Homework 6. Deadline. Purpose. How to submit. Important notes. Problem 1. Spring CS Homework 6 p. 1 Spring 2018 - CS 328 - Homework 6 p. 1 Deadline Due by 11:59 pm on Sunday, March 11, 2018. Purpose CS 328 - Homework 6 To encourage you to look over the course PHP style standards, and to give you more

More information

Lecture 2 Unix and PHP. INLS 523 Web Databases Spring 2013 Rob Capra

Lecture 2 Unix and PHP. INLS 523 Web Databases Spring 2013 Rob Capra Lecture 2 Unix and PHP INLS 523 Web Databases Spring 2013 Rob Capra Server-Side Scripting Server-side scripting Scripts run on the server Scripts return HTML to the client Apache Open-source Perl and PHP

More information

Chapter. Accessing MySQL Databases Using PHP

Chapter. Accessing MySQL Databases Using PHP Chapter 12 Accessing MySQL Databases Using PHP 150 Essential PHP fast Introduction In the previous chapter we considered how to create databases using MySQL. While this is useful, it does not enable us

More information

PHP Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37)

PHP Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37) PHP Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37) A Server-side Scripting Programming Language An Introduction What is PHP? PHP stands for PHP: Hypertext Preprocessor. It is a server-side

More information

PHP Dynamic Web Pages, Without Knowing Beans

PHP Dynamic Web Pages, Without Knowing Beans PHP Dynamic Web Pages, Without Knowing Beans Kimberly Bobrow Jennery Intelliclass kimberly@bobrow.net kimberly@jennery.com Page Agenda Introduction Basic Syntax General Language Constructs File Handling

More information