Site icon sharedsapience.info

PHP MySQLi Function Mini-Quiz 2: From mysqli::debug() to mysqli::get_connection_stats().

The mysqli::debug() PHP MySQLi function, sized for mobile viewing.

An image of the mysqli::debug() PHP MySQLi function, sized for mobile viewing.

HOW THE QUIZ WORKS:

Clicking the ‘randomize’ button situated above the reference table generates a new table whereby the function descriptions, function syntaxes, and function return values are randomized. The quiz involves matching the function descriptions, function syntaxes, and function return values to the correct function name. Information relating to the randomization of table cells will be displayed for three seconds, before disappearing.

On a desktop computer, table elements are selected by left-clicking the desired table cell and holding the left click in the mouse down position for one second before releasing the left click. The text inside the table cell will turn red to indicate that the one-second mouse left-click has successfully selected a table cell. To then swap the selected table cell with the target table cell, simply repeat the one-second left mouse-click process on the target cell; the table cells will swap position. To de-select a table cell, simply repeat the one-second left mouse-click process on the original table cell.

To select a table element on a touchscreen device (mobile, tablet), simply touch the desired table cell and maintain the touch for one second before removing your finger from the screen. The text inside the table cell will turn red to indicate that the one-second touch has successfully selected a table cell. To then swap the selected table cell with the target table cell, simply repeat the one-second touch process on the target cell; the table cells will swap position. To de-select a table cell, simply repeat the one-second touch process on the original table cell.

Normal touchscreen scrolling behaviour is exhibited by the cells with a light green background; cells without a light green background will not respond to normal touchscreen scrolling. The table is positioned in such a way that the user can also initiate touchscreen scrolling by swiping to the right or left of the table.

When a row consists of the correct function name, function description, function syntax, and function return value, the background colour of the row will change from ‘transparent’ to ‘khaki’; this provides visual feedback that the row is complete.

Once the entire table is complete, a paragraph of feedback will congratulate the user and provide the following information: date and time of quiz commencement; date and time of quiz completion; and the length of time it took the user to complete the quiz.

VIEWPORT OPTIONS:

An example of the layout designed for mobile phones
An example of the layout designed for tablets
An example of the layout designed for desktop computers

PURPOSE:

This webpage serves two purposes:

  1. It provides a reference table for the PHP MySQLi functions, with information extracted and condensed from w3schools.com and php.net.
  2. It enables users to complete a quiz related to the PHP MySQLi functions.

USAGE:

For each PHP MySQLi function there are four table cells of information: the function name; the function description; the function syntax; and the function return value. There are three layouts available – ‘mobile‘, ‘tablet‘, and ‘desktop‘.

Click the relevant button below to display the PHP MySQLi functions reference table, sized appropriately for the desired viewport. A ‘RANDOMIZE‘ button appears above the reference table once the viewport is selected; clicking this button facilitates the commencement of a quiz.



Click the ‘RANDOMIZE‘ button to randomize the functional descriptions, the functional syntaxes, and the functional return information.


FUNCTION NAME FUNCTION DESCRIPTION FUNCTION SYNTAX FUNCTION RETURN VALUE
mysqli::debug()
mysqli_debug()

[mysqli::debug — mysqli_debug – Performs debugging operations]

This function performs debugging operations using the Fred Fish debugging library. The MySQL client library must be compiled to support debugging in order to use this function. Object-oriented style:
mysqli->debug(message);

Procedural style:
mysqli_debug(message);

[message: a string representation of the debugging operation to perform.]

mysqli::debug(): returns TRUE.
mysqli::dump_debug_info()
mysqli_dump_debug_info()

[mysqli::dump_debug_info — mysqli_dump_debug_info – Dump debugging information into the log]

This function is used to dump connection-related debugging information into the MySQL Server log. mysqli::dump_debug_info() is designed to be invoked by a user with the SUPER privilege. Object-oriented style:
$mysqli->dump_debug_info();

Procedural style:
mysqli_dump_debug_info(mysqli_link);

[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init(); only required for the procedural style.]

mysqli::dump_debug_info(): returns TRUE on success; FALSE on failure.
mysqli::$errno()
mysqli_errno()

[mysqli::$errno — mysqli_errno – Returns the error code for the most recent function call]

This function returns the last error code [‘number’/‘no’] for the most recent MySQLi function call that can succeed or fail. The MySQL header file, errmsg.h, contains a list of client error message numbers; mysqld_error.h lists server error message numbers. A complete list of error message numbers and error messages can be found in the file Docs/mysqld_error.txt of the MySQL source distribution. Object-oriented style:
$mysqli->errno;

Procedural style:
mysqli_errno(mysqli_link);

[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init(); only required for the procedural style.]

mysqli::$errno(): returns an error code value for the last function call, if it failed.
A return value of 0 means no error occurred.
mysqli::$error_list()
mysqli_error_list()

[mysqli::$error_list — mysqli_error_list – Returns a list of errors from the last command executed]

This function returns an array [‘list’] of errors pertaining to the last MySQLi function call that can succeed or fail. Object-oriented style:
$mysqli->error_list;

Procedural style:
mysqli_error_list(mysqli_link);

[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init(); only required for the procedural style.]

mysqli::$error_list(): returns a list of errors, each as an associative array containing the errno, error, and sqlstate.
mysqli::$error()
mysqli_error()

[mysqli::$error — mysqli_error – Returns a string description of the last error]

This function returns the last error message for the most recent MySQLi function call that can succeed or fail. Object-oriented style:
$mysqli->error;

Procedural style:
mysqli_error(mysqli_link);

[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init(); only required for the procedural style.]

mysqli::$error(): returns a string that describes the error or an empty string if no error occurred.
mysqli::$field_count()
mysqli_field_count()

[mysqli::$field_count — mysqli_field_count – Returns the number of columns for the most recent query]

This function returns the number [‘count’] of columns [‘fields’] for the most recent query on the connection represented by $mysqli/mysqli_link. This function can be useful to determine whether a query should have produced a non-empty result set – without knowing the nature of the query – when working with the mysqli_store_result() function. Object-oriented style:
$mysqli->field_count;

Procedural style:
mysqli_field_count(mysqli_link);

[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init(); only required for the procedural style.]

mysqli::$field_count(): returns an integer representation of the number of fields in a result set.
mysqli::get_charset()
mysqli_get_charset()

[mysqli::get_charset — mysqli_get_charset – Returns a character set object]

This function returns [‘gets’] a character set object, providing several properties of the current, active character set. Object-oriented style:
$mysqli->get_charset();

Procedural style:
mysqli_get_charset(mysqli_link);

[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init(); only required for the procedural style.]

mysqli::get_charset(): returns a character set object with the following properties: charset [character set name]; collation [collation name]; dir [directory the charset was fetched from, or “” for built-in character sets]; min_length [minimum character length in bytes]; max_length [maximum character length in bytes]; number [internal character set number]; and state [character set status].
mysqli::$client_info()
mysqli::get_client_info()
mysqli_get_client_info()

[mysqli::$client_info — mysqli::get_client_info — mysqli_get_client_info – Get MySQL client info]

This function returns [‘gets’] a string representation [‘info’] of the MySQL client library version. Object-oriented style – flavour one:
$mysqli->client_info;

Object-oriented style – flavour two:
$mysqli->get_client_info();

Procedural style:
mysqli_get_client_info(mysqli_link);

[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init(); only required for the procedural style.]

mysqli::get_client_info(): returns a string representation of the MySQL client library version.
mysqli::$client_version()
mysqli_get_client_version()

[mysql::$client_version — mysqli_get_client_version – Returns the MySQL client version as an integer]

This function returns (‘gets’) the MySQL client version number as an integer. It is useful in situations where you need to quickly know if some capability exists. Object-oriented style:
$mysqli->client_version;

Procedural style:
mysqli_get_client_version(mysqli_link);

[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init(); only required for the procedural style.]

mysqli::$client_version(): returns a number that represents the MySQL client library version in the following format: [main_version * 10000 + minor_version * 100 + sub_version].
mysqli::get_connection_stats()
mysqli_get_connection_stats()

[mysqli::get_connection_stats — mysqli_get_connection_stats – Returns statistics about the client connection]

This function returns (‘gets’) statistics (‘stats’) about the client connection. It is only available with mysqlnd. Object-oriented style:
$mysqli->get_connection_stats();

Procedural style:
mysqli_get_connection_stats(mysqli_link);

[mysqli_link: a link identifier returned by mysqli_connect() or mysqli_init(); only required for the procedural style.]

mysqli::get_connection_stats(): returns an array with connection stats on success; FALSE on failure. The array consists of approximately 120 elements, ranging from bytes_sent to proto_binary_fetched_other.

Web design certified by:
Click images for proof of certification.


Exit mobile version