Q1. How many type of header function in PHP? what are the uses of Header() Function in PHP?
Ans.
In PHP Programming, It's very important to know about Header() function. Header function is always calles before the actual output code is send. For getting the result output we need to run function just before the HTML or any type of ECHO statement.
There are the following uses of header function in PHP
1). Header function is use to redirect the page to another page.
2). Header function is used to send HTTP header to client at Browser.
3). Header function is used to refresh the page at given time in function.
4). Header function is used to send email content Example: - CC, BCC, Reply and data and other information.
Q2. In how many ways can we retrive the data from the database in the table?
Ans.
We can retrive the data from the database with the help of 4 ways like: -
1). mysqli_fetch_row - By this method we get the result as an Enumerated array.
2). mysqli_fetch_array - By this method we get the result in associated and numeric array.
3). mysqli_fetch_object - By this method we get the result set as object.
4). mysqli_fetch_assoc - By this method we get the result with associative array.
These are the 4 ways by that we can easily get the data result from the database.
Q3. What are the GET and POST Method in form Submit in PHP Programming?
Ans. These Methods are used from the server side for sending data into the database.
1). GET Method - In this Method, sent data display into the URL in Browser address. This method is used for sending the small amount of data and sensitive data take place into the GET Method.
2). POST Method - In this Method, sent data doesn't display into the URL in browser address. This method is used for sending a large amount of data using browser. this post methods are used into banking web application where data is more sensitive.
3). Request Method - In this Method, We retrieve or receive the data from the Browser URL which is sent by GET or POST Method whatever is this.
Q4. What are the different type of errors and warnings in PHP Programming?
Ans.
In PHP, There are 3 Types of errors.
1). Notices :- Notices error generates when variable is not defined in the Web-Application.
2). Warnings : - In this error, warning is show on error but page script do not terminates while executing the PHP page.
3). fatel errors : - In this error, this type of errors occurs when not defined function or class is called. this errors immediate terminate the PHP script or page execution while running.
Q5. What is the Value of "$days" in the below written code?
Ans.
Q6. How to determine the total number of element of an array?
Ans.
With the help of PHP functions we can easily determine the total number of elements into an array.
Example: -
1). sizeof($array_variable)
2). count($array_variable)
But if we pass only simple variable instead of an array then it will return 1.
Q7. How to determine or find Current Date and Time?
Ans.
With the Help of Date() function we can find the or retrieve the current date and time value. but if we use only time() function then it will return only the unix timestamp.
Q8. What is the difference between these 2 variable -> $variable and $$variable?
Ans.
$$variable sets the value of $variable as a variable.
Ans.
Cookies are the flat files those stores into the users or clients computer when the visits any website. Don't worry about these files because it do not damage client computer.
for setting the cookies: - setcookie(name, value, expire, path, domain);
We always set the cookie in past for destroying it.
Example:-
setcookie("user", "ashok", time()+3600);
setcookie("user", "", time()-3600); for destroy cookies from the system.
Q10. How can we find the number of rows in a result set using PHP?
Ans.
For finding the number of rows from the database. we have to perform the following query and PHP function like.
Example: -
Ans.
In PHP Programming, It's very important to know about Header() function. Header function is always calles before the actual output code is send. For getting the result output we need to run function just before the HTML or any type of ECHO statement.
There are the following uses of header function in PHP
1). Header function is use to redirect the page to another page.
2). Header function is used to send HTTP header to client at Browser.
3). Header function is used to refresh the page at given time in function.
4). Header function is used to send email content Example: - CC, BCC, Reply and data and other information.
Q2. In how many ways can we retrive the data from the database in the table?
Ans.
We can retrive the data from the database with the help of 4 ways like: -
1). mysqli_fetch_row - By this method we get the result as an Enumerated array.
2). mysqli_fetch_array - By this method we get the result in associated and numeric array.
3). mysqli_fetch_object - By this method we get the result set as object.
4). mysqli_fetch_assoc - By this method we get the result with associative array.
These are the 4 ways by that we can easily get the data result from the database.
Q3. What are the GET and POST Method in form Submit in PHP Programming?
Ans. These Methods are used from the server side for sending data into the database.
1). GET Method - In this Method, sent data display into the URL in Browser address. This method is used for sending the small amount of data and sensitive data take place into the GET Method.
2). POST Method - In this Method, sent data doesn't display into the URL in browser address. This method is used for sending a large amount of data using browser. this post methods are used into banking web application where data is more sensitive.
3). Request Method - In this Method, We retrieve or receive the data from the Browser URL which is sent by GET or POST Method whatever is this.
Q4. What are the different type of errors and warnings in PHP Programming?
Ans.
In PHP, There are 3 Types of errors.
1). Notices :- Notices error generates when variable is not defined in the Web-Application.
2). Warnings : - In this error, warning is show on error but page script do not terminates while executing the PHP page.
3). fatel errors : - In this error, this type of errors occurs when not defined function or class is called. this errors immediate terminate the PHP script or page execution while running.
Q5. What is the Value of "$days" in the below written code?
Ans.
$Tuesday= 1; $days = ($Tuesday==1) ? 'Today' : 'Tommorrow'; // $days is set to 'today'.This question was about Ternary operator. most of the companies ask the question about ternary operator because this operator has minimized the use of if else condition using this.
Q6. How to determine the total number of element of an array?
Ans.
With the help of PHP functions we can easily determine the total number of elements into an array.
Example: -
1). sizeof($array_variable)
2). count($array_variable)
But if we pass only simple variable instead of an array then it will return 1.
Q7. How to determine or find Current Date and Time?
Ans.
With the Help of Date() function we can find the or retrieve the current date and time value. but if we use only time() function then it will return only the unix timestamp.
Q8. What is the difference between these 2 variable -> $variable and $$variable?
Ans.
$$variable sets the value of $variable as a variable.
$days='Tuesday';
$$days='Second day of week';
echo $Tuesday;
//outputs 'Second day of week'.
Q9. How to set and destroy cookie in PHP Programming?Ans.
Cookies are the flat files those stores into the users or clients computer when the visits any website. Don't worry about these files because it do not damage client computer.
for setting the cookies: - setcookie(name, value, expire, path, domain);
We always set the cookie in past for destroying it.
Example:-
setcookie("user", "ashok", time()+3600);
setcookie("user", "", time()-3600); for destroy cookies from the system.
Q10. How can we find the number of rows in a result set using PHP?
Ans.
For finding the number of rows from the database. we have to perform the following query and PHP function like.
Example: -
$result_rows = mysql_query($sql_query, $db_link); $num_of_rows = mysql_num_rows($result_rows); echo $num_of_rows['field_name']; // Number of rows found
0 comments:
Post a Comment