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



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/php/function-reference/mysqli_set_local_infile_default.php