|
Posted by Jim Hernandez on 02/27/06 00:02
Alright I've been at this for a few hours and I'm not totally
frustrated, just wanting to make sure that there's not some obvious
solution here that I'm missing.
I have an album review site and I'd like for my visitors to be able to
use links that are easy to remember. For example instead of
(mod_rewritten url) mysite.com/albums/32, I'd instead pass the actual
title of the album (pulled from mysql query) into the url parameter
using dashes.
replacing: albums/32
with: albums/The-Album-Title
Right now this works like a charm, I've got a url prep function that
adds dashes into whitespaces in the title, and I've got a small
'cleaner' function that strips the dashes out of the title and then
passes it via sprintf into a mysql query and the review details are
pulled based on that.
So the query ends up like:
$query_Review = sprintf("SELECT albums.REVIEW FROM albums where
albums.NAME LIKE '%%%s%%'", $colname_TITLE);
My issue is when whatever I'm trying to pass in the URL parameter
already has dashes in it. When I put it through url preparation it adds
dashes to any whitespace, and then the dashes are stripped out on the
details page for the mysql query. Despite my best efforts (within my
realm of knowledge) I've been unable to get it to leave the original
dashes in there, while stripping the prep dashes out. Any original
dashes are also stripped, which throws off the mysql query and doesn't
return anything. Am I missing something obvious here?
Navigation:
[Reply to this message]
|