I'm trying to translate URLs into human readable ones so http://www.site.com/some-category/page1.html would become http://www.site.com/some-category/some-page-title.html:
if ( isset($_GET['item_url']) ) { $item_title = str_replace('-', ' ', $_GET['item_url']); }
$sql = "SELECT item_title, item_text FROM table WHERE item_title LIKE '%" . $item_title . "%'";
$query = mysql_query($sql) or die("Query failed ($sql): " . mysql_error());
$item = mysql_fetch_assoc($query);
// Display item title and item text
All is well unless the item_title field contains a comma, a hyphen or brackets, say, "Why, another page title" - then it doesn't just match against "Why another page title". Obviously, I'm doing something wrong so any help is appreciated...
PHP 5.2.4, MySQL 4.1.22, if it matters.