Here is code:
$connect = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if($connect->connect_errno) {
printf("Connect failed: %s\n", $connect->connect_error);
exit();
}
function send($username="", $password="") {
$connect->query("INSERT INTO table1 (username, password) VALUES ('$username', '$password')");
}
$connect->close();
Notice: Undefined variable: connect in C:\xampp\htdocs\playground01\build\components\includes\root.php on line 44
Fatal error: Call to a member function query() on null in C:\xampp\htdocs\playground01\build\components\includes\root.php on line 44
Where is a problem?