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... 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? 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 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 Quote 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 '}' 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 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 Link to comment https://forums.phpfreaks.com/topic/202826-replace-spaces-with-hyphens/#findComment-1062965 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.