0

I have the following code:

include_once('includes/config.php');
include_once('includes/ingame.inc.new.php');

in my config.php file, I have this:

$con = mysqli_connect($dbhost,$dblogin,$dbpassword);

In my ingame.inc.new.php:

    function getSomething($id)
    {
    $sql = 'MY_QUERY';

    $result = mysqli_query($con, $sql);
    if (!$result) {
      echo mysqli_error($con);
    }
}

Unfortunately, the $con variable is undefined inside the function.

What I can do to use my $con inside the function that runs a query?

TheUnreal
  • 23,434
  • 46
  • 157
  • 277

0 Answers0