hitk Posted July 8, 2010 Share Posted July 8, 2010 Ok. I have ZERO PHP Knowledge, still good in editing php and all that stuff. Only know copy paste and have no knowledge what that means. Still would try to explain my problem. I use variable to fetch data from mysql. Ex. my url is http://www.example.com/venue.php?vcity=New York. Now, I want to replace New York with New-York. The real url I am trying to get is http://www.example.com/venue-new-york.php. For that I added code in htaccess RewriteRule ^venue-([^/]*)\.php$ /venue.php?vcity=$1 [L] I Know what I added in htaccess is mostly perfect. Now, I am using smarty so would be able to do lower case and replace space with dash. But that would not allow me to fetch data from mysql for some reason. In class file I have following code. function getallvenueschedule() { global $db,$smarty; $sql = " SELECT * FROM table WHERE vcity = '$this->vcity' AND sch_date >= '$this->sch_date' ORDER BY timestmp ASC"; $theList = $db->getAll($sql); return $theList; } In the php file below is code. $vcity = $_GET['vcity']; I hope I provided almost all details. Problem is that whatever data is in variable vcity (examp. if I have new-york in url then it will search new-york in mysql rather new york Link to comment https://forums.phpfreaks.com/topic/207098-preg_replace-space-to-dash/ Share on other sites More sharing options...
hitk Posted July 8, 2010 Author Share Posted July 8, 2010 Some how, Problem resolved (not totally but still good enough). http://www.daniweb.com/forums/post1269994.html Link to comment https://forums.phpfreaks.com/topic/207098-preg_replace-space-to-dash/#findComment-1082998 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.