kyleldi Posted March 13, 2009 Share Posted March 13, 2009 I know it's possible, but I can't figure this out... How do I go about using str_replace at the same time as ucwords? '.str_replace ucwords("+"," ",$row_rs_multi_cats['category']).' That's what I have so far. Thank you!! Link to comment https://forums.phpfreaks.com/topic/149236-solved-str_replace-and-ucwords/ Share on other sites More sharing options...
Mark Baker Posted March 13, 2009 Share Posted March 13, 2009 str_replace("+"," ",ucwords($row_rs_multi_cats['category'])) or ucwords(str_replace("+"," ",$row_rs_multi_cats['category'])) It can make a difference, though it shouldn't in this case Link to comment https://forums.phpfreaks.com/topic/149236-solved-str_replace-and-ucwords/#findComment-783679 Share on other sites More sharing options...
kyleldi Posted March 13, 2009 Author Share Posted March 13, 2009 I tried both versions and get "Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'" on that line for both of them. Link to comment https://forums.phpfreaks.com/topic/149236-solved-str_replace-and-ucwords/#findComment-783697 Share on other sites More sharing options...
Mark Baker Posted March 13, 2009 Share Posted March 13, 2009 Show us the whole line of code, plus a couple of lines either side Link to comment https://forums.phpfreaks.com/topic/149236-solved-str_replace-and-ucwords/#findComment-783706 Share on other sites More sharing options...
kyleldi Posted March 13, 2009 Author Share Posted March 13, 2009 do { echo '<div class="thumbframe"> <div class="thumb"><a href="downloads.php?category='.str_replace(" ","+",$row_rs_multi_cats['category']).'"><img src="images/downloads/'.str_replace(" ","+",$row_rs_multi_cats['category']).'.jpg" alt="'.str_replace("+"," ",$row_rs_multi_cats['category']).'" width="100" height="58" border="0" longdesc="downloads.php?category='.str_replace(" ","+",$row_rs_multi_cats['category']).'" /></a></div> <div>'str_replace("+"," ",ucwords($row_rs_multi_cats['category']))'</div></div>'; /// This is where it dies /// } while ($row_rs_multi_cats = mysql_fetch_assoc($rs_multi_cats)); } else{ Link to comment https://forums.phpfreaks.com/topic/149236-solved-str_replace-and-ucwords/#findComment-783715 Share on other sites More sharing options...
Mark Baker Posted March 13, 2009 Share Posted March 13, 2009 Don't forget . to concatenate strings echo '<div class="thumbframe"> <div class="thumb"><a href="downloads.php?category='.str_replace(" ","+",$row_rs_multi_cats['category']).'"><img src="images/downloads/'.str_replace(" ","+",$row_rs_multi_cats['category']).'.jpg" alt="'.str_replace("+"," ",$row_rs_multi_cats['category']).'" width="100" height="58" border="0" longdesc="downloads.php?category='.str_replace(" ","+",$row_rs_multi_cats['category']).'" /></a></div> <div>'.str_replace("+"," ",ucwords($row_rs_multi_cats['category'])).'</div></div>'; /// This is where it dies /// Link to comment https://forums.phpfreaks.com/topic/149236-solved-str_replace-and-ucwords/#findComment-783722 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.