w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Connect to database in php and include once, but connect file not in root

Above $con add:

global $con;

If that doesn't help please paste a larger chunk of code.

In your updated code you have a scope issue. Add global $con inside the method and problem solved.

global $con;
$result = $con->query("SELECT name,image

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.