Jump to content

replace spaces with hyphens


violinrocker

Recommended Posts

$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

									   
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

									   
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 '}'

  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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.