You are here: Variable manipulation for use in URL Parameter « PHP SQL « IT news, forums, messages
Variable manipulation for use in URL Parameter

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация