w3resource

PHP mysqli: set_local_infile_default() function

mysqli_set_local_infile_default function / mysqli::set_local_infile_default

The mysqli_set_local_infile_default function / mysqli::set_local_infile_default — unsets user defined handler for load local infile command.

Syntax:

mysqli_set_local_infile_default(connection);

Parameter:

Name Description Required/Optional
connection Specifies the MySQL connection to use Required
charset Specifies the default character set Required

Return value:

No value is returned.

Version: PHP 5, PHP 7

Example:


$db = mysqli_init();
  $db->real_connect("localhost","user1","datasoft123","hr");

  function callme($stream, &$buffer, $buflen, &$errmsg)
  {
    $buffer = fgets($stream);

    echo $buffer;

    // convert to upper case and replace "," delimiter with [TAB]
    $buffer = strtoupper(str_replace(",", "\t", $buffer));

    return strlen($buffer);
  }


  echo "Input:\n";

  $db->set_local_infile_handler("callme");
  $db->query("LOAD DATA LOCAL INFILE 'input.txt' INTO TABLE t1");
  $db->set_local_infile_default();

  $res = $db->query("SELECT * FROM t1");

  echo "\nResult:\n";
  while ($row = $res->fetch_assoc()) {
    echo join(",", $row)."\n";
  }

See also

PHP Function Reference

Previous: set_charset
Next: set_local_infile_handler



Follow us on Facebook and Twitter for latest update.

PHP: Tips of the Day

To use the constant simply use its name:

Example:

if (EARTH_IS_FLAT) {
 print "Earth is flat";
}
print APP_ENV_UPPERCASE; 

Output:


or if you don't know the name of the constant in advance, use the constant function:

// this code is equivalent to the above code
$const1 = "EARTH_IS_FLAT";
$const2 = "APP_ENV_UPPERCASE";
if (constant($const1)) {
 print "Earth is flat";
}
print constant($const2);

Output:


 





We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook