0
In my case I have this function :
in the Home archive at the very beginning imported here:
<?php
require_once("session.php");
require_once("class_usuario.php");
$auth_user = new USER();
$user_id = $_SESSION['user_session'];
$stmt = $auth_user->runQuery("SELECT * FROM N00_Usuario WHERE idUsuario=:user_id");
$stmt->execute(array(":user_id"=>$user_id));
$userRow=$stmt->fetch(PDO::FETCH_ASSOC);
?>
e no arquivo Home importei a classe que está dentro do arquivo Class_usuario:
<?php
require_once("session.php");
require_once("class_usuario.php");
$auth_user = new USER();
$user_id = $_SESSION['user_session'];
$stmt = $auth_user->runQuery("SELECT * FROM N00_Usuario WHERE idUsuario=:user_id");
$stmt->execute(array(":user_id"=>$user_id));
$userRow=$stmt->fetch(PDO::FETCH_ASSOC);
?>
<div class="box bg-primary">
<i class="fa fa-eye"></i>
<?php
try{
$a= ContaUsuario($connection) ;
}
catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
?>
<h3><?php echo $a;?></h3>
<p class="lead">Page views</p>
</div>
</div>
what’s wrong? Someone has an idea?
I’ll try to see what gives @Felipe
– Gladiador
If it doesn’t work post here, I’ll try to find another way. @Gladiador
– Felipe
Then @Felipe the error contains. Maybe pq explained wrong. the function is in another file called Class_usuario and the part <H3><? php echo $a;? ></H3> is also in another Home file. I want to list the total number of registered users
– Gladiador
Did you import the Class_usuario file? Can you post the Class_usuario code? @Gladiator If it is a php class you must instantiate an object in the class and call the method.
$obj = new Class_Usuario();
$rows = $obj.ContaUsuario($connection);
– Felipe
I just posted the code . I edited it for you to see and if you can see anything wrong.
– Gladiador
Is what you posted just the code from the Home file? @Gladiador
– Felipe
I posted the two comrade. on top is the class_usuario and at the end and the Home
– Gladiador
Let’s go continue this discussion in chat.
– Felipe
@Gladiator mark as answered, this helps the community and others who come to see the question.
– Felipe