483Lab2(rating) - CPIS483 E- Systems Application Rating...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
CPIS483 E- Systems Application Rating “Lab # 2 Prepared by: Hanadi Alkhudhayr Mcs
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Objectives revision on PHP (syntax, Comments, Variables, Naming Rules for Variables, Functions What is rating Rating example Creating a vote database Writing the voting script assignment 3/14/2011 2 CPIS483 LAB #2 HANADI ALKHUDHAYR Mcs
Background image of page 2
Basic PHP Syntax PHP code is executed on the server, and the plain HTML result is sent to the browser. A PHP scripting block always starts with <?php and ends with ?> . A PHP scripting block can be placed anywhere in the document. On servers with shorthand support enabled you can start a scripting block with <? and end with ?>. A PHP file normally contains HTML tags, just like an HTML file, and some PHP scripting code. 3/14/2011 3 CPIS483 LAB #2 HANADI ALKHUDHAYR Mcs
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Comments in PHP In PHP, we use // to make a single-line comment or /* and */ to make a large comment block Example: <html> <body> <?php //This is a single-line comment /* This is a comment block */ ?> </body> </html> 3/14/2011 4 CPIS483 LAB #2 HANADI ALKHUDHAYR Mcs
Background image of page 4
Variables in PHP 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: $var_name = value; 3/14/2011 5 CPIS483 LAB #2 HANADI ALKHUDHAYR Mcs
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
PHP is a Loosely Typed Language 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. 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. 3/14/2011 6 CPIS483 LAB #2 HANADI ALKHUDHAYR Mcs
Background image of page 6
Naming Rules for Variables A variable name must start with a letter or an underscore "_" A variable name can only contain alpha- numeric characters and 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) 3/14/2011 7 CPIS483 LAB #2 HANADI ALKHUDHAYR Mcs
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
PHP Functions The real power of PHP comes from its functions. In PHP, there are more than 700 built-in functions.
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/10/2012 for the course IS 483 taught by Professor Sallah during the Spring '12 term at King Abdulaziz University.

Page1 / 28

483Lab2(rating) - CPIS483 E- Systems Application Rating...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online