0

MySQLiconfig.php:

<?php
$MySQLi   = new mysqli('localhost','root','123','Database') or die('ERROR');

Other document:

<?php
require 'MySQLiconfig.php';

function DoAQuery($Query){
   $MySQLi->query($Query);
}

The error is:

 Undefined variable: MySQLi
Entimon
  • 184
  • 3
  • 11

1 Answers1

-1

You are wrong with variable scope. In the function you need to use like global $MySQLi or you can pass as function parameter.

Tapos
  • 601
  • 4
  • 8