PHP Tutorial - PHP mysqli_refresh() Function






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//from www  .j a va 2 s  . 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);
?>