bsv77 Posted August 13, 2011 Share Posted August 13, 2011 I have a re-write rule that takes the URL such as: /products/?bookname=late-rain and displays it like: /products/late-rain and the my script uses the bookname value to search the database. I am running into an issue in that if the value is say "Late Rain" with spaces or "Late-Rain" with dashes, the script will not use that as it should. What is the best way to query something like WHERE bookname = "late-rain"? It may instead be the rewrite as it adds a trailing / when it does not work. If there are no spaces or anything, it works just fine. Thanks for the advise in advance. Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted August 13, 2011 Share Posted August 13, 2011 You need to do a echo $_GET['bookname']; and see what is there. Quote Link to comment Share on other sites More sharing options...
bsv77 Posted August 14, 2011 Author Share Posted August 14, 2011 Yes, I know how to see the variable, the issue is that it does not work when there is a dash in the url like "book name" Quote Link to comment Share on other sites More sharing options...
voip03 Posted August 14, 2011 Share Posted August 14, 2011 In my knowledge you cannot use dash for variables. Please check with ' php rules' Quote Link to comment Share on other sites More sharing options...
skwap Posted August 14, 2011 Share Posted August 14, 2011 You are not provided your code. Use this example - <?php $book_name = trim(strtolower($_GET['bookname'])); $book_name = str_replace(" ","-",$book_name); ?> 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.