Web-6
function returns an array containing the values for each column in the current row of the query result
mysql_fetch_row
To query the database, we call function _________________________ specifying the _________________________ and _________________________
mysql_query,(mysqli_query,) - query string - the database to query
Function _________________________ selects and opens the database to be queried.
mysql_select_db (mysqli_select_db)
Function define creates a _________________________ . It takes two arguments : _____________ and ____________________. An optional third argument accepts a boolean value that specifies whether the constant is _________________________
named constant the name and value of the constant is case insensitive
function that moves the internal pointer to the next element.
next function
_________________________ piece of information that's stored by a server in a text file on a client's computer to maintain information about the client during and between browsing sessions.
a cookie
what is the die () function's optional argument ?
a string, which is printed as the script exits.
The optional third argument to function preg_match is :
an array that stores matches to each parenthetical statement of the regular expression.
The mysql_error function returns :
any error strings from the database
what happened when assigning a value to an element where the index is omitted ?
appends a new element to the end of the array.
Arrays with nonnumeric indices are called
associative arrays.
the third argument in define function by default is :
case sensitive (true)
what does The concatenation operator (.) do ?
combines multiple strings
what does Function strcmp do ?
compares two strings. - returns -1 if the first string alphabetically precedes the second string, - returns 0 if the strings are equal - returns 1 if the first string alphabetically follows the second.
function print can be used to display a value of a variable which helps in :
debugging a script
Quantifiers are used in regular expressions to :
denote how often a particular character or set of characters can appear in a match.
(T/F) Casting does change a variable's content .
f , it does not change a variable's content , it creates a temporary copy of a variable's value in memory.
The power of the web resides not only in serving content to users, but also _________________________
in responding to requests from users and generating web pages with dynamic content
Function that returns the index of the element currently referenced by the internal pointer
key function
a series of characters that serve as pattern-matching templates (or search criteria) in strings, text files and databases.
regular expressions
Function that used to sets the internal pointer to the first array element.
reset function
what does The arrays $_GET and $_POST do ?
retrieve information sent to the server by HTTP get and post requests,
Type conversions can be performed using function _________________________
settype
what does the first elemnt in the function preg_match array stores ?
stores the string matched for the entire pattern
you should initialize the variable before they are used to avoid :
subtle error
forgetting to terminate a statement with a ; will cause _________________________
syntax error
assigning a value to a constant after it declared is a :
syntax error , but only when using define function , otherwise it will be treated as new variable
(T/F) Calling function settype can result in loss of data.
t
(T/F) php is case sensitive
t
what does function die() do ?
terminates script execution.
If a value is assigned to an array element of an array that does not exist, then :
the array is created
We escape the normal meaning of a character in a string by preceding it with :
the backslash character (\).
The \b before and after the parentheses indicates :
the beginning and end of a word
Function gettype returns _________________________
the current type of its argument.
what does Function preg_replace return ?
the modified string
we should validate sensitive and important form data such as password on _________________________
the server
what does Function count returns ?
the total number of elements in the array.
Variables are typed based on _________________________
the values assigned to them.
what do we mean by PHP variables are loosely typed ?
they can contain different types of data at different times.
A bracketed expression containing two or more adjacent character classes in the class delimiters represents :
those character sets combined
why we should use business logic ?
to ensure that invalid information are not stored in the database
what does this method of converting (double).$x ?
type casting
what does Function preg_match do ?
uses regular expressions to search a string for a specified pattern
what are the Bracket expressions ?
lists of characters enclosed in square brackets ([]) that match any single character from the list.
failure to use the proper mixture of cases (use the variable with different letters cases) to refer to a variable will result in _________________________ , why ?
logical error , because the script will create a new variable foe any name does not recognize it
To find multiple instances of a given pattern, we must make :
multiple calls to preg_match, and remove matched instances before calling the function again by using a function such as preg_replace.
_________________________ closes the connection to the database specified in its argument.
mysql_close
Function _________________________ connects to the MySQL database
mysql_connect ( mysqli_connect )
when Uninitialized variables Is interrupted in a string context , it is evaluated to :
"undef"
Regular expressions can include metacharacters such as : (explain )
( ^ ) : matches the beginning of a string ( $ ) : matches the end of a string. ( . ) : matches any single character.
what is PHP ?
- Hypertext Preprocessor - has become the most popular server-side scripting language for creating dynamic web pages.
(T/F) A server can access only the cookies that it has placed on the client.
T
(T/F) Uninitialized variables have undefined values that evaluate differently
T
when cookie lasts only until the end of the current session cookie is known as _____________ while one with an expiration date is a persistent cookie.
- a session cookie - a persistent cookie.
Function setcookie() takes the _________________________ as the first argument, followed by _________________________ & it had an optional third argument indicates _________________________
- name of the cookie to be set - the value to be stored in the cookie. -the expiration date of the cookie.
PHP code is embedded directly into _________________________ such as _____________ , though these script segments are _________________________ before being delivered to the client.
- text-based documents, - HTML - interpreted by a server
When converting from a string to a number, PHP uses the value of the number that appears at _________________________ . If no number appears , the string evaluates to
- the beginning of the string - 0.
what happened if no expiration date is specified in the cookie ?
- the cookie lasts only until the end of the current session known as (
what are the arguments passed to the function settype()?
- the variable - the new data type " "
Uninitialized variables In a numeric context, is evaluated to :
0
how can we add a comments in php ?
1 ) // 2 ) # 3 ) for long comment /* */
If a pattern is found, preg_match returns _____________ and if it doesn't , it return _____________
1 , 0
You can create an associative array using the operator _________________________ , where the value to the left of the operator is the _________________________ and the value to the right is the _________________________ .
1) => 2) array index or key 3) element's value
Function preg_match takes how many arguments ? what are they ?
2, - a regular- expression pattern to search for - the string to search.
Function preg_replace takes how many arguments ? what are they ?
3 - the pattern to match, - a string to replace the matched string - the string to search
In PHP, code is inserted between the scripting delimiters , such as _________________________
<?php and ?>
are enclosed by the delimiters [: and :].
Character classes
(T/F) when using method = "post" , Scripts located on the web server's machine cannot access the form data sent as part of the request.
F , Can
(T/F) All operations requiring PHP interpolation execute on the server after the HTML5 document is sent to the client.
F , befor
(T/F) Keywords may be used as function, method, class or namespace names in define function .
F , cannot be used
(T/F) PHP code cannot be placed anywhere in HTML5 markup
F, as long as the code is enclosed with delimiters.
(T/F) Function preg_match performs case-insensitive pattern matches
F, case-sensitive
(T/F) Anything enclosed in single quotes in a print statement is interpolated.
F, not interpolated, unless the single quotes are nested in a double-quoted string literal.
are associative arrays predefined by PHP that hold variables acquired from user input, the environment or the web server and are accessible in any variable scope.
Superglobal arrays