Jump to content

prestashop run mysql_num_rows query according to db class?


Recommended Posts

Hi,

I have a custom query in my module. The query is something like

 



$sql = "SELECT * FROM "._DB_PREFIX_."product_lang  WHERE `name` like '".$_GET['name']."%'";
$rows = Db::getInstance()->executeS($sql);
foreach ( $rows as $row ){
  $productName = $row['name'];
  echo '<li class="product-details">'.$productName.'</li>';
}


Here its working absolutely fine. But lets say there is no results found (MySQL return result if 0 rows returned) then I want to show one message like 'sorry ne results found'.For that I need to run 

 



if(mysql_num_rows($rows) > 0) {
}


But how to run mysql_num_rows in prestashop according to DB Class? Can some one kindly tell me how to run this query using db class? Any help will be really appreciable. Thanks.

Link to comment
Share on other sites

×
×
  • Create New...