jeger003 Posted January 13, 2009 Share Posted January 13, 2009 i have a classified site and the titles of my ads are stored like: Brand+new+spaceship+for+sale i want it to display with out the "+" how do i do this? this is my code so far below $sql_query = "SELECT user_id FROM sessions WHERE listings_session = \"".$_COOKIE["listing_session"]."\""; $results = mysql_query($sql_query) or die(mysql_error()); while($user_id = mysql_fetch_array($results)) $query = 'SELECT title FROM listings WHERE seller = '.$user_id['user_id'].' '; $result2 = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result2)){ echo "<br>".$row['date']."."; } Link to comment https://forums.phpfreaks.com/topic/140617-solved-how-do-i-retrieve-text-and-display-to-user-in-proper-english/ Share on other sites More sharing options...
corbin Posted January 13, 2009 Share Posted January 13, 2009 http://php.net/str_replace echo str_replace('+', ' ', 'hello+world'); Link to comment https://forums.phpfreaks.com/topic/140617-solved-how-do-i-retrieve-text-and-display-to-user-in-proper-english/#findComment-735887 Share on other sites More sharing options...
jeger003 Posted January 13, 2009 Author Share Posted January 13, 2009 http://php.net/str_replace echo str_replace('+', ' ', 'hello+world'); oh awesome!! it worked great, but now it won't display (',&) characters an example of what it displayed Selling - Bike %2AMINT Condition%2A ----supposed to display Selling - Bike *MINT Condition* American Gov%27t - Items For Sale----supposed to display American Gov't - Items For Sale code after your add $sql_query = "SELECT user_id FROM sessions WHERE listings_session = \"".$_COOKIE["listings_session"]."\""; $results = mysql_query($sql_query) or die(mysql_error()); while($user_id = mysql_fetch_array($results)) $query = 'SELECT title FROM listings WHERE seller = '.$user_id['user_id'].' '; $result2 = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result2)){ echo "<br>".str_replace('+', ' ', $row['title'])."<br>"; } Link to comment https://forums.phpfreaks.com/topic/140617-solved-how-do-i-retrieve-text-and-display-to-user-in-proper-english/#findComment-735903 Share on other sites More sharing options...
DarkWater Posted January 13, 2009 Share Posted January 13, 2009 urldecode() Link to comment https://forums.phpfreaks.com/topic/140617-solved-how-do-i-retrieve-text-and-display-to-user-in-proper-english/#findComment-735904 Share on other sites More sharing options...
jeger003 Posted January 13, 2009 Author Share Posted January 13, 2009 how do i use that urldecode() in my code? Link to comment https://forums.phpfreaks.com/topic/140617-solved-how-do-i-retrieve-text-and-display-to-user-in-proper-english/#findComment-735905 Share on other sites More sharing options...
jeger003 Posted January 13, 2009 Author Share Posted January 13, 2009 AH IT WORKS!!!! while($row = mysql_fetch_array($result2)){ echo urldecode($row['title']); } Thank You guys SO MUCH! Link to comment https://forums.phpfreaks.com/topic/140617-solved-how-do-i-retrieve-text-and-display-to-user-in-proper-english/#findComment-735907 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.