Wednesday, March 19, 2014

If you set a cookie with either setcookie() or header(), you can immediately check to see whether the client accepted it.

A. True, you can check the $_COOKIE superglobal array to see if it contains the

value you set.

B. True, but only if register_globals is enabled.

C. False, you can only use setcookie() if you need to test for acceptance.

Using header() does not work.

D. False, you must wait until you receive another HTTP request to determine

whether it includes the Cookie header.


Answer D is correct.The response that contains the Set-Cookie header is not sent

When an expiration date is given in a Set-Cookie header, what is the resulting behavior in subsequent requests?

A. If the expiration date has expired, the cookie is not included.

B. The behavior is the same; the expiration date is included in the Cookie

header, and you can access this information in the $_COOKIE superglobal

array.

C. The cookie persists in memory until the browser is closed.

D. The cookie is deleted and therefore not included in subsequent requests.


Answer A is correct.

Which of the following form element names can be used to create an array in PHP?

A. foo

B. [foo]

C. foo[]

D. foo[bar]

Answer C is correct. PHP will create an enumerated array called foo that contains

When processing the form, what is the difference between a hidden form element and a nonhidden one, such as a text box?

A. The hidden form element does not have a name.

B. There is no difference.

C. The hidden form element does not have a value.

D. The hidden form element is excluded from the request.

Answer

Answer B is correct.When processing a form, each form element is simply a

name/value pair within one of the superglobal arrays. Answers A and C are incorrect

because hidden form elements can (and should) have both a name and a

value. Answer D is incorrect because hidden form elements are only excluded

from the user’s view, not from the HTTP request.

Which types of form elements can be excluded from the HTTP request?

A. text, radio, and check box

B. text, submit, and hidden

C. submit and hidden

D. radio and check box

Answer
 D. radio and check box

Is it possible to pass data from JavaScript to PHP?

A. Yes, but not without sending another HTTP request.

B. Yes, because PHP executes before JavaScript.

C. No, because JavaScript is server-side, and PHP is client-side.

D. No, because JavaScript executes before PHP.

Answer

Answer A is correct. Although your instincts might lead you to believe that you

cannot pass data from JavaScript to PHP, such a thing can be achieved with another
 

Tuesday, August 6, 2013

Listing Stored Procedures in a MySQL Database

MySQL provides you with several useful statements that help you manage stored procedures effectively. Those statements include listing stored procedures and showing the stored procedure’s source code.

Displaying stored procedures characteristics

To display characteristics of a stored procedure, you use the following statement:
The SHOW PROCEDURE STATUS statement is a MySQL extension to SQL standard. This statement gives you the stored procedure’s characteristics including database, stored procedure name, type, creator and so on.
You can use LIKE or WHERE clause to filter out the stored procedure based on various criteria.
To list all stored procedures of the databases that you have the privilege to access, you use the  SHOW PROCEDURE STATUS statement as follows:
If you want to show just stored procedure in a particular database, you can use the WHERE clause in the  SHOW PROCEDURE STATUS statement:
If you want to show stored procedures that have a particular pattern e.g., its name has word product, you can use the LIKE operator as the following command:

Displaying stored procedure’s source code

To display source code of a particular stored procedure, you use the SHOW CREATE PROCEDURE statement as follows:
You specify the name of the stored procedure after the  SHOW CREATE PROCEDURE keywords. For example, to display the code of the GetAllProducts stored procedure, you use the following statement:
In this tutorial, you have learned some useful statements including  SHOW PROCEDURE STATUS and  SHOW CREATE PROCEDURE statements to list stored procedures in a database and get the source code of the stored procedure