violinrocker Posted May 25, 2010 Share Posted May 25, 2010 $title = str_replace( " ", "-", $row[title]); $eno = str_replace( " ", "-", $row[eno]); while($row = mysql_fetch_array($result)){ echo "<table width='100%' border='0' bgcolor='#3B3B3B'> <tr> <th width='8%' rowspan='2' scope='col'><img src='$row[thumb]' alt='thumb' width='74' height='56' border='1'></th> <th width='92%' scope='col'><div align='left'><a href='http://janime.tv/{$row[page_id]}/{$title}/{$eno]}'>{$title} {$eno]}</a></div></th> </tr> <tr> <th scope='col'><div align='left'>watch anime</div></th> </tr> </table>"; } problem with this code is... for all the links only the latest row is used and replaced... Quote Link to comment https://forums.phpfreaks.com/topic/202826-replace-spaces-with-hyphens/ Share on other sites More sharing options...
violinrocker Posted May 25, 2010 Author Share Posted May 25, 2010 *looks for edit post link* how do i replace the spaces with hyphens with every row... not just the replaced string of the latest row on all the rows? Quote Link to comment https://forums.phpfreaks.com/topic/202826-replace-spaces-with-hyphens/#findComment-1062959 Share on other sites More sharing options...
-Karl- Posted May 25, 2010 Share Posted May 25, 2010 while($row = mysql_fetch_array($result)){ $title = str_replace( " ", "-", $row[title]); $eno = str_replace( " ", "-", $row[eno]); echo "<table width='100%' border='0' bgcolor='#3B3B3B'> <tr> <th width='8%' rowspan='2' scope='col'><img src='$row[thumb]' alt='thumb' width='74' height='56' border='1'></th> <th width='92%' scope='col'><div align='left'><a href='http://janime.tv/{$row[page_id]}/{$title}/{$eno]}'>{$title} {$eno]}</a></div></th> </tr> <tr> <th scope='col'><div align='left'>watch anime</div></th> </tr> </table>"; } Try that Quote Link to comment https://forums.phpfreaks.com/topic/202826-replace-spaces-with-hyphens/#findComment-1062960 Share on other sites More sharing options...
violinrocker Posted May 25, 2010 Author Share Posted May 25, 2010 while($row = mysql_fetch_array($result)){ $title = str_replace( " ", "-", $row[title]); $eno = str_replace( " ", "-", $row[eno]); echo "<table width='100%' border='0' bgcolor='#3B3B3B'> <tr> <th width='8%' rowspan='2' scope='col'><img src='$row[thumb]' alt='thumb' width='74' height='56' border='1'></th> <th width='92%' scope='col'><div align='left'><a href='http://janime.tv/{$row[page_id]}/{$title}/{$eno]}'>{$title} {$eno]}</a></div></th> </tr> <tr> <th scope='col'><div align='left'>watch anime</div></th> </tr> </table>"; } Try that syntax error, unexpected ']', expecting '}' Quote Link to comment https://forums.phpfreaks.com/topic/202826-replace-spaces-with-hyphens/#findComment-1062961 Share on other sites More sharing options...
-Karl- Posted May 25, 2010 Share Posted May 25, 2010 while($row = mysql_fetch_array($result)){ $title = str_replace( " ", "-", $row[title]); $eno = str_replace( " ", "-", $row[eno]); echo "<table width='100%' border='0' bgcolor='#3B3B3B'> <tr> <th width='8%' rowspan='2' scope='col'><img src='$row[thumb]' alt='thumb' width='74' height='56' border='1'></th> <th width='92%' scope='col'><div align='left'><a href='http://janime.tv/{$row[page_id]}/{$title}/{$eno}'>{$title} {$eno}</a></div></th> </tr> <tr> <th scope='col'><div align='left'>watch anime</div></th> </tr> </table>"; } Try that Quote Link to comment https://forums.phpfreaks.com/topic/202826-replace-spaces-with-hyphens/#findComment-1062963 Share on other sites More sharing options...
violinrocker Posted May 25, 2010 Author Share Posted May 25, 2010 haha... sorry about that, I found the error... i have ] near eno... works perfectly now... thanks Quote Link to comment https://forums.phpfreaks.com/topic/202826-replace-spaces-with-hyphens/#findComment-1062965 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.