Query on Custom Files

Hi
I try to show recapitulation of data in custom file
but data not show
i place this script on custom template → content

$sql

<?php $sql = Executescalar("SELECT COUNT(`detail`.`id_det`) FROM detail"); ?>

Executive Resume

Detail

can you anybody help me?

Thank You

Have you already enabled “Include common files” when creating that Custom File?

Thank you
I already enables “include common files”
I make this script refer on example 3 custom files help…
Thank you for your help

I have the option Include common files checked and I just want to be able to run a simple SQL query but it just doesn’t do it, it’s not a complex query it’s just a simple total.

<div class = "small-box bg-info" style = "font-size: 25px; display: inline-block; float: left; width: 45%; margin: 5px; box-sizing: border-box;">
<div class = "inner">
<h1><b>$sql</b> </h1>
<? php
$ sql = Executescalar ("SELECT Count (users.ID) AS users FROM users");
?>
<p style = "font-size: 25px; font-weight: bold"> Users </p>
</div>
<div class = "icon">
<i class = "fas fa-book-reader"> </i>
</div>
<a href="#" class="small-box-footer">
Detail <i class = "fas fa-arrow-circle-right"> </i>
</a>
</div>

I tried thousands of ways to show me the query but it doesn’t.

Change your code:
Executescalarto:
ExecuteScalarIt is case-sensitive.

mobhar wrote:

Change your code:
Executescalar> to:
ExecuteScalar> It is case-sensitive.

custom file:
user_count.php…

<?php $sql = ExecuteScalar("SELECT Count(users .ID) AS users FROM users "); //get the value only only by ExecuteScalar ?>

$sql

Users

Detalle
...It doesn't work for me, I tried various forms of query without success.

Change:

<h1><b>$sql</b></h1>

to:

<h1><b><?php echo "Count = " . $sql; ?></b></h1>
<div class="small-box bg-info" style ="font-size : 25px; display: inline-block; float: left; width : 45%; margin : 5px; box-sizing : border-box;">
<div class="inner">
<?php
$sql = ExecuteScalar("SELECT Count(usuarios.userID) AS usuarios FROM usuarios");
?>
<h1><b><?php echo "Count = " . $sql; ?></b></h1>
<p style="font-size : 25px; font-weight: bold ">Users</p>
</div>
<div class="icon">
<i class="fas fa-book-reader"></i>
</div>
<a href="#" class="small-box-footer">Detalle  <i class="fas fa-arrow-circle-right"></i></a>
</div>

It works perfect, it shows the result of the query. But … I would like not to show the count message, but simply the result of the query.

Simply change:

<h1><b><?php echo "Count = " . $sql; ?></b></h1>

to:

<h1><b><?php echo $sql; ?></b></h1>

Thank you very much, if I have offended you, I apologize.