PHP || old paper solution 2017

4th semester

Group A

1.  Register_global variablesis an internal PHP setting which registers the $_REQUEST array’s elements as variables. If you submit a value in a form, via POST or GET, the value of that input will automatically be accessible via variable in the PHP script, named after the name of the input field.
2. To create a constant,  weuse the define() function.
Syntax :- define(name, value)
Example:-

 

4.   A Web server is a program that uses HTTP (Hypertext Transfer Protocol) to serve the files that form Web pages to users, in response to their requests, which are forwarded by their computers’ HTTP clients. Dedicated computers and appliances may be referred to as Web servers as well.
5.  The trim() function removes whitespace and other predefined characters from both sides of a string.
Example:-

Output:-
Without trim: Hello World!
With trim: Hello World!
6.  A uniform resource locator (URL) is the address of a resource on the Internet. A URL indicates the location of a resource as well as the protocol used to access it.
7.  Mysql_fetch_row fetch result row an numeric way. This function return a row where the valuew will come in the order as they are defined in the query, and the keys will span from 0 to one less than the number of columns selected
Mysql_fetch_assoc() fetch a result row as an associative array.This function will return a row as an associative array where the column names will be the keys storing corresponding value.
8.

 
9. The PHP date() function is used to format a date and/or a time.
Example:-

 
10. A CSV (Comma Separated Values) file is a text based format that represents the data typically found in a spreadsheet or a database table.
Advantages of CSV :-

  1. CSV files can be opened or edited by text editors like notepad.
  2. In data-warehouse, CSV follows a fairly flat, simple schema.
  3. Any programming language to parse CSV data is trivial, generating it is extremely easy.
  4. Importing CSV files can be much faster, and it also consumes less memory.

 


Group B

11. Write PHP code to perform server side validation. (check for empty, alphabets, numbers, email and password length validation) 









12. Write a function to calculate sum of all even numbers that occurs between given two integers passed as parameters. 

 

13. Create an array that contains your name, address, age, gender. Then write the array to the file name “profile.csv”. 

14. Create a login system, making your own assumptions about database, authorize the login credentials. 

15. Write a PHP function to calculate the difference between two dates in PHP. 


Leave a Reply

Your email address will not be published. Required fields are marked *