0

hi am trying to make related products box but not work as i want. for examples i am on the page of nokia asha 102. then i want to output related products al nokia asha. means query detect only nokia asha word and after nokia asha all words remove. and i want just keep first 2 sentences on string and other sentence trim. when i try to do this its work but if nokia asha related products not avail then i want select another products but same brands. so am getting problem here becuase its not work its show all by brand (not related) or empty show or show random. below my query

        $pre = preg_replace('/[0-9]+/', '', $ptitle); // if someone make this as it trim all except 1st 2 sentence eg: nokia asha, or nokia lumia
        $stmtr = $db->prepare("SELECT 
    title,
    aurl 
    FROM products 
    WHERE title like :pre
     or 
    brand like :brand
 limit 18");
        $stmtr->bindValue('pre', "%$pre%", PDO::PARAM_STR);
        $stmtr->bindValue('brand', "%$brand%", PDO::PARAM_STR);
        $stmtr->execute();

so how i fix this issue?

  • There is any error ? maybe from mysql ? use error_reporting(E_ALL); – 4EACH Mar 23 '14 at 22:29
  • @4EACH no i dont get any error its works but not as i want. in simple words i just need to make this related products query which show related products by `$pre` var – user3450945 Mar 23 '14 at 22:31

0 Answers0