Hi
I am venturing into the world of "friendly URL's" on a site I am rebuilding and part of the site contains product details saved in a database. An example of a URL maybe:
http://www.mydomain.com/products/my-product-name/the-product-code
In most cases this is fine but some of the products in the database have 'product codes' such as:
1.2.3.4
1-2-3-4
1 2 3 4
1 (234)
So my problem is that i need to change all of these product codes to "friendly URL" strings before passing the variable that the string will be saved to to the query which retrieves the data from the database. i.e.
select * from mytable where productname = "my-product-name" and productcode = "the-product-code"
My understanding is the best way to sort this (i.e to create a friendly URL variable to pass to my database query) would be to use regex but this is new ground to me - could anyone provide a snippet or example of how to create a function that would sort these strings into freindly URL's?
Thanks for any support.