Jump to content

How to foreach items for database on 1.5


Esnyper

Recommended Posts

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 by Esnyper (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...