Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8979961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:57:58+00:00 2026-06-15T19:57:58+00:00

I can’t figure out the error above. Has anyone seen this before. I am

  • 0

I can’t figure out the error above. Has anyone seen this before. I am using PHP with Smarty and incorporating PDO into my code.

PHP var_dump of code $data $smarty->assign("results", $data);

 object(PDOStatement)#22 (1) { 
  ["queryString"]=> string(236) "SELECT p.id,p.brag,p.brag_desc,p.brag_id,p.user_id, p.panel_id,p.domainurl,p.type,p.price FROM ruj_users_bg as p left join ruj_users as u on p.user_id=u.id WHERE u.status !=0 and 1 and p.status = 1 GROUP BY p.id DESC LIMIT 0 OFFSET 25" }

PHP Error from Smarty template:

Notice: Object of class PDOStatement could not be converted to int in /var/www/vhosts/somesite.com/httpdocs/templates_c/3d14690fd8419657273a6dce45bbca85dfc1e261.file.bragsdata.tpl.php on line 25

Line 25 from Smarty template:

$_smarty_tpl->tpl_vars[‘smarty’]->value[‘section’][‘res’][‘loop’] = is_array($_loop=$_smarty_tpl->getVariable(‘results’)->value) ? count($_loop) : max(0, (int)$_loop); unset($_loop);

Not sure where the problem is here. Your help is very appreciated.

update: Function call with fetchAll(PDO::FETCH_ASSOC);

 $data = fetchData($limit_start,$page_records);

 function fetchData$limit_start,$page_records){
            $db = Core::getInstance();
            $sql = "SELECT id FROM ruj_users_bg WHERE
                   (type = :type3 OR type = :type4) 
                   AND status =:uno 
                   ORDER BY id DESC LIMIT :lim OFFSET :page";

    $res = $db->dbh->prepare($sql);
            $res->bindValue(':type3',3, PDO::PARAM_INT);                
            $res->bindValue(':type4',4, PDO::PARAM_INT);
            $res->bindValue(':uno',1, PDO::PARAM_INT);
            $res->bindValue(':lim',(int)$limit_start, PDO::PARAM_INT);
            $res->bindValue(':page',(int)$page_records, PDO::PARAM_INT);
    $res->execute();
        $res->fetchAll(PDO::FETCH_ASSOC);       

    return $res;

}           
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:57:59+00:00Added an answer on June 15, 2026 at 7:57 pm

    That’s because PDOStatement is strictly not an array type. It implements Traversable though, so I’m surprised that Smarty doesn’t accept it as something that can be looped over.

    To turn your database results into a standard array, you’d have to use ->fetchAll():

    $smarty->assign('results', $data->fetchAll(PDO::FETCH_ASSOC));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone help me trying to find out why this doesn't work. The brushes
Can anyone explain to me why this program: for(float i = -1; i <
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Can PHP PDO extension bind nested objects automatically ? I mean using foreign key
Can't seem to figure out what's wrong with the simple getJSON call below. It's
Can anyone explain me what's going on? I use this method - (BOOL)shouldAutorotateToInterfaceOrientation:( UIInterfaceOrientation)interfaceOrientation
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Can somebody help me convert this VB function to Perl (PHP, Ruby or Python
Can anyone tell me how to open Auto CAD file in HTML5? Is this
Can any one help me in sorting this out in sed/awk/perl Input file Start

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.