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'] 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. 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>"); 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. 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 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. 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. 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
Archived
This topic is now archived and is closed to further replies.