Jump to content

Select count value in php


Santori

Recommended Posts

Hello guys, I have a little issue with php:

 

I need to retrieve the count of sql and show it at tpl but results are always 1, not the count results, 

Can you help me please?

 

public function hook()
    {
 
    $sql = (int)Db::getInstance()->Execute ('SELECT COUNT(*) as A  FROM ps_table WHERE validate = 1'); 
    $this->context->smarty->assign(array(
            'variable' => $sql,));
    return $this->display(__FILE__, 'template.tpl');
 
        }
 
Then in template with {$variable} the results = 1, but not the count
 
What Im doing wrong?
Edited by Santori (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...