Presentation is loading. Please wait.

Presentation is loading. Please wait.

8 th Semester, Batch 2009 Department Of Computer Science SSUET.

Similar presentations


Presentation on theme: "8 th Semester, Batch 2009 Department Of Computer Science SSUET."— Presentation transcript:

1 8 th Semester, Batch 2009 Department Of Computer Science SSUET

2 Web Server Software & Programming/Scripting Language: When setting out to build a site, products you need are as follows. Web server software Database management system Programming/scripting language Hardware for the web server An Operating system

3 Web Server Software & Programming/Scripting Language: Some of these are dependent on others for example not all operating run on all hardware and not all scripting can connect to any other database. From the above products for developing any website the three main ingredients that plays major role for developing websites, and to work the websites professionally, for retrieving web pages, ensuring secure data storage are Web server soft wares, database management system, scripting language.

4 Web Server Software: A computer program that is responsible for accepting HTTP requests from web clients, which are known as web browsers and serving them HTTP responses along with optional data contents, which usually are web pages such as HTML documents and linked objects (images, etc.). Internet Information server IIS Apache

5 Database management system: A database management system should be there at server side, which enables you to store, retrieve, search and sort the data. The database should provide access to the data; it must allow multiple user access concurrently and only authorized person access. Sql Server My Sql Oracle

6 Programming/Scripting Language: Programming languages are used to design your web pages. The choice of programming depend on that it should have easy connectivity with the database, it should be platform independent ASP.Net PHP Java server pages Perl

7 What is PHP? PHP is a server side scripting language designed for developing websites. Within an HTML page you can embed PHP code which is executed each time the page is visited. Your page is interpreted at web server and generates HTML code, which your browser can understand.

8 What is MySQL? MySql is a fast, robust database management system, which enables you for the data accessing according to request. Mysql control accessing of the data to ensure that multiple user can work with it concurrently, so that the accessing to the data can be possible through world wide.

9 Some of PHP’s Strength: PHP also offers features like other programming language like high performance, integration to many different databases, built in libraries, strong object oriented support, but the main features which can meet the requirement that make the PHP best choice are: Cost Portability Open source

10 Some of PHP’s Strength: Cost: PHP is free. You can download the latest version at any time for no cost. Portability: PHP can work on Cross platform. You can write your PHP code on multiple platforms. It will work on UNIX, Linux, Solaris or any other version of Microsoft Windows, due to this nature it offers; LAMPP(Linux Apache MySQL PHP) WAMPP(Windows Apache MySQL PHP) Open Source: You have access to PHP source code it does not demand for any license. Unlike closed source product you are free to make any change to the code

11 Basic PHP Syntax: A PHP scripting block always starts with. A PHP file normally contains HTML tags, just like an HTML file, and some PHP scripting code. Below, we have an example of a simple PHP script which sends the text "Hello World" to the browser.

12 Basic PHP Syntax: Example: <?php echo "Hello World"; ?> Each code line in PHP must end with a semicolon. The semicolon is a separator and is used to distinguish one set of instructions from another

13 Comments in PHP: In PHP, we use // to make a single-line comment or /* and */ to make a large comment block. Example: <?php // This is a comment /* This is a comment block */ ?>

14 Variables in PHP: The correct way of setting a variable in PHP: Example1: $var_name = value; Example2: <?php $txt = "Hello World!"; $number = 16; ?>

15 PHP is a Loosely Typed Language: In PHP a variable does not need to be declared before being set. 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 how they are set. In a strongly typed programming language, you have to declare (define) the type and name of the variable before using it. In PHP the variable is declared automatically when you use it.

16 Strings in PHP Example <?php $txt="Hello World"; echo $txt; ?>

17 The Concatenation Operator: There is only one string operator in PHP. The concatenation operator (.) is used to put two string values together. To concatenate two variables together, use the dot (.) operator. Example: <?php $txt1="Hello World"; $txt2="1234"; echo $txt1. " ". $txt2; ?>

18 The Concatenation Operator: Output of the code above is: Hello World 1234

19 Using the strlen() function: The strlen () function is used to find the length of a string. Example: <?php echo strlen("Hello world!"); ?> The output of the code above will be: 12

20 Using the strpos() function The strpos() function is used to search for a string or character within a string. If a match is found in the string, this function will return the position of the first match. If no match is found, it will return FALSE. Example: <?php echo strpos("Hello world!","world"); ?>

21 Using the strpos() function The Output of the above code is. 6 As you see the position of the string "world" in our string is position 6. The reason that it is 6, and not 7, is that the first position in the string is 0, and not 1.

22 Conditional Statements if...else statement - use this statement if you want to execute a set of code when a condition is true and another if the condition is not true elseif statement - is used with the if...else statement to execute a set of code if one of several condition are true

23 The If...Else Statement If you want to execute some code if a condition is true and another code if a condition is false, use the if.... else statement. Syntax: if (condition) code to be executed if condition is true;else code to be executed if condition is false;

24 The If...Else Statement Example: <? php $d=date("D"); if ($d=="Fri") echo "Have a nice weekend!"; else echo "Have a nice day!"; ?>

25 The ElseIf Statement If you want to execute some code if one of several conditions are true use the elseif statement Syntax: if (condition) code to be executed if condition is true; elseif (condition) code to be executed if condition is true; else code to be executed if condition is false;

26 The ElseIf Statement Example: 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!". <?php $d=date("D"); if ($d=="Fri") echo "Have a nice weekend!"; elseif ($d=="Sun") echo "Have a nice Sunday!"; else echo "Have a nice day!"; ?>

27 The PHP Switch Statement Use the switch statement to select one of many blocks of code to be executed. Syntax switch (n) { case label1: code to be executed if n=label1; break; case label2: code to be executed if n=label2; break; default: code to be executed if n is different from both label1 and label2; }

28 The PHP Switch Statement Example


Download ppt "8 th Semester, Batch 2009 Department Of Computer Science SSUET."

Similar presentations


Ads by Google