secoxxx Posted August 22, 2008 Share Posted August 22, 2008 how would you go about exploding this. the "title" looks like this in the db, "Gold prospecting in Oregon" I want "Gold-prospecting-in-Oregon" $row['title'] how would you explode using this type? i understand using it like so explode("-", $title); but not with $row['title'] Quote Link to comment https://forums.phpfreaks.com/topic/120841-solved-php-explode-how-to/ Share on other sites More sharing options...
ratcateme Posted August 22, 2008 Share Posted August 22, 2008 do you want to replace " " with "-" str_replace(" ","-",$title); Scott. Quote Link to comment https://forums.phpfreaks.com/topic/120841-solved-php-explode-how-to/#findComment-622897 Share on other sites More sharing options...
secoxxx Posted August 22, 2008 Author Share Posted August 22, 2008 i understand how to replace the space with the -, its the way the query is pulled using the $row['title'] rather than just $title in the explode, thats where im stumped. its in a echo like so echo ("<title>". $row['title']. "</title>"); Quote Link to comment https://forums.phpfreaks.com/topic/120841-solved-php-explode-how-to/#findComment-622898 Share on other sites More sharing options...
ratcateme Posted August 22, 2008 Share Posted August 22, 2008 do you mean explode("-", $row['title']); Scott. Quote Link to comment https://forums.phpfreaks.com/topic/120841-solved-php-explode-how-to/#findComment-622899 Share on other sites More sharing options...
secoxxx Posted August 22, 2008 Author Share Posted August 22, 2008 Its in a echo echo ("<title>". $row['title']. "</title>"); cant seem to get it to work Quote Link to comment https://forums.phpfreaks.com/topic/120841-solved-php-explode-how-to/#findComment-622901 Share on other sites More sharing options...
ratcateme Posted August 22, 2008 Share Posted August 22, 2008 so do you want <title>Gold-prospecting-in-Oregon</title> this will give you that echo "<title>". str_replace(" ","-",$row['title']) . "</title>"; Scott. Quote Link to comment https://forums.phpfreaks.com/topic/120841-solved-php-explode-how-to/#findComment-622902 Share on other sites More sharing options...
secoxxx Posted August 22, 2008 Author Share Posted August 22, 2008 Awesome, thanks Scott. one more thing added to know knowledge base. Quote Link to comment https://forums.phpfreaks.com/topic/120841-solved-php-explode-how-to/#findComment-622905 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.