vendredi 24 juillet 2020

Variables inside included file doesnt work inside php function in another file?

     <?php 
session_start();
 if(!isset($_POST['id'])) {
    require_once '../../../db/config.php';

function a() {
    print_r($conn);
}

echo a();

The following problem outputs the error Notice: Undefined variable: con con is usual mysql database connection variable in config.php, outside the function it works without any problem.




Aucun commentaire:

Enregistrer un commentaire