Esnyper Posted November 2, 2012 Share Posted November 2, 2012 (edited) Hi, I'am going to update testimonials module for prestashop 1.5, but I can't understand how to use Prestashop functions. I even can't find any documentation about working with database. I have function: public function viewTestimonials () { //Sukuriame masyvą kuriame laikysime atsiliepimus $output = array(); $db = Db::getInstance(); $vnt = $db->Execute('SELECT COUNT(*) FROM `'._DB_PREFIX_.'testimonials`'); $result = $db->Execute('SELECT * FROM `'._DB_PREFIX_.'testimonials` ORDER BY testimonial_id DESC'); while ($row = mysqli_fetch_assoc($vnt)) { $results[] = $row; } global $smarty; $smarty->assign(array('testimonials' => $results)); return $this->display(__FILE__, 'rodyti_atsiliepimus.tpl'); } With this code I have this error: Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given Can anyone help my with this? Thank you! Edited November 2, 2012 by Esnyper (see edit history) Link to comment Share on other sites More sharing options...
Alex Simonchik BelVG Posted November 2, 2012 Share Posted November 2, 2012 Hi, you need use ExecuteS instead of Execute in your example. Great guide is there http://doc.prestashop.com/display/PS15/DB+class+best+practices and http://www.prestashop.com/blog/en/good_practices_on_class_db_for_prestashop_141/ Regards Link to comment Share on other sites More sharing options...
Esnyper Posted November 2, 2012 Author Share Posted November 2, 2012 (edited) Thanks! Edited November 2, 2012 by Esnyper (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now