PHP mysqli_refresh() Function

In this chapter you will learn:

  1. Definition for PHP mysqli_refresh() Function
  2. Syntax for PHP mysqli_refresh() Function
  3. Parameter for PHP mysqli_refresh() Function
  4. Return for PHP mysqli_refresh() Function
  5. Example - refreshes tables or caches, or resets the replication server information

Definition

The mysqli_refresh() function refreshes tables or caches, or resets the replication server information.

Syntax

PHP mysqli_refresh() Function has the following syntax.

mysqli_refresh(connection,options);

Parameter

ParameterDescription
connectionRequired. Specifies the MySQL connection to use
optionsThe options to refresh.

options can be one of more of the following (separated by OR):

OptionMeaning
MYSQLI_REFRESH_GRANTRefreshes the grant tables
MYSQLI_REFRESH_LOGFlushes the logs
MYSQLI_REFRESH_TABLESFlushes the table cache
MYSQLI_REFRESH_HOSTSFlushes the host cache
MYSQLI_REFRESH_STATUSResets the status variables
MYSQLI_REFRESH_THREADSFlushes the thread cache
MYSQLI_REFRESH_SLAVEResets the master server info, and restarts the slave
MYSQLI_REFRESH_MASTERRemoves the binary log files in the binary log index, and truncates the index file

Return

It returns TRUE on success and FALSE on failure.

Example

refreshes tables or caches, or resets the replication server information


<?php//  ja v a2s . c o  m
$con=mysqli_connect("localhost","my_user","my_password","my_db");
if (mysqli_connect_errno($con)){
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

mysqli_refresh($con,MYSQLI_REFRESH_LOG);

mysqli_close($con);
?>

Next chapter...

What you will learn in the next chapter:

  1. Definition for PHP mysqli_rollback() Function
  2. Syntax for PHP mysqli_rollback() Function
  3. Parameter for PHP mysqli_rollback() Function
  4. Return for PHP mysqli_rollback() Function
  5. Example - rolls back the current transaction for the specified database connection
Home » PHP Tutorial » PHP MySQLi Functions
PHP mysqli_affected_rows() Function
PHP mysqli_autocommit() Function
PHP mysqli_change_user() Function
PHP mysqli_character_set_name() Function
PHP mysqli_close() Function
PHP mysqli_commit() Function
PHP mysqli_connect() Function
PHP mysqli_connect_errno() Function
PHP mysqli_connect_error() Function
PHP mysqli_data_seek() Function
PHP mysqli_dump_debug_info() Function
PHP mysqli_errno() Function
PHP mysqli_error() Function
PHP mysqli_error_list() Function
PHP mysqli_fetch_all() Function
PHP mysqli_fetch_array() Function
PHP mysqli_fetch_assoc() Function
PHP mysqli_fetch_field() Function
PHP mysqli_fetch_field_direct() Function
PHP mysqli_fetch_fields() Function
PHP mysqli_fetch_lengths() Function
PHP mysqli_fetch_object() Function
PHP mysqli_fetch_row() Function
PHP mysqli_field_count() Function
PHP mysqli_field_seek() Function
PHP mysqli_field_tell() Function
PHP mysqli_free_result() Function
PHP mysqli_get_charset() Function
PHP mysqli_get_client_info() Function
PHP mysqli_get_client_stats() Function
PHP mysqli_get_client_version() Function
PHP mysqli_get_connection_stats() Function
PHP mysqli_get_host_info() Function
PHP mysqli_get_proto_info() Function
PHP mysqli_get_server_info() Function
PHP mysqli_get_server_version() Function
PHP mysqli_info() Function
PHP mysqli_init() Function
PHP mysqli_insert_id() Function
PHP mysqli_kill() Function
PHP mysqli_more_results() Function
PHP mysqli_multi_query() Function
PHP mysqli_next_result() Function
PHP mysqli_num_fields() Function
PHP mysqli_num_rows() Function
PHP mysqli_options() Function
PHP mysqli_ping() Function
PHP mysqli_query() Function
PHP mysqli_real_connect() Function
PHP mysqli_real_escape_string() Function
PHP mysqli_refresh() Function
PHP mysqli_rollback() Function
PHP mysqli_select_db() Function
PHP mysqli_set_charset() Function
PHP mysqli_sqlstate() Function
PHP mysqli_ssl_set() Function
PHP mysqli_stat() Function
PHP mysqli_stmt_init() Function
PHP MySQL mysqli_thread_id() Function
PHP mysqli_thread_safe() Function