justlukeyou Posted June 13, 2012 Share Posted June 13, 2012 Hi, I have roled out pretty URLs throughout my site however I am stuggling to search for more than one keyword. I can add links for "widgets" but not "red-widgets". Can anyone advise how - between the keywords in a query link? RewriteRule ^products/nameproductscategorised/([a-zA-Z-]+)$ /products/productscategorised.php?name=$1 Quote Link to comment Share on other sites More sharing options...
justlukeyou Posted June 14, 2012 Author Share Posted June 14, 2012 Hi, Does anyone have any suggestions on how I can do this please? Quote Link to comment Share on other sites More sharing options...
Jessica Posted June 14, 2012 Share Posted June 14, 2012 You already have the - in your rule. What happens when you try the link with red-widgets? if you echo $_GET['name'] on the page what does it say? Quote Link to comment Share on other sites More sharing options...
justlukeyou Posted June 14, 2012 Author Share Posted June 14, 2012 Hi, If I query "red" on any of the following then "red" is echoed. If I query "red-" then nothing is echoed and it blocks the query so nothing is displayed. [a-zA-Z0-9]+)$ [a-zA-Z0-9\-]+)$ [a-zA-Z0-9\-\s]+)$ Quote Link to comment Share on other sites More sharing options...
Jessica Posted June 14, 2012 Share Posted June 14, 2012 Show the code that processes $_GET['name'] - just the relevant code Quote Link to comment Share on other sites More sharing options...
justlukeyou Posted June 14, 2012 Author Share Posted June 14, 2012 Hi, This is complete code I am using: <?php $name = mysql_real_escape_string($_GET['name']); $query = mysql_query(" SELECT name, product_id, rrp, discount, image_link FROM productdbase p INNER JOIN groups f ON f.long_name = p.group WHERE name LIKE '%{$name}%' LIMIT 15"); while ($query_row = mysql_fetch_assoc($query)) { ?> <div class="productrangeborder"> <div class="productsdetailsborder"> <a href="/product/<?php echo $query_row['product_id']; ?>" class='productlink' rel="nofollow" ><?php echo $query_row['name']; ?> </a> </div> <div class="productimageborder"> <a href="/product/<?php echo $query_row['product_id']; ?>" rel="nofollow"><img src="<?php echo $query_row['image_link']; ?>"/></a> </div> <div class="priceborder">Price £<?php echo $query_row['rrp']; ?><br /></div><div class="discountborder">Save <?php echo $query_row ['discount']; ?>%<br /> </div></div> <?php echo $_GET['name'] ?> <?php } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.