Ну, а если так:
<a href='index.php?name=shop&op=view&id=".substr($ban[$i], 0, 4)."' target='_self'>
или так:
<a href='index.php?name=shop&op=view&id=".substr($ban[$i], 0, -4)."' target='_self'>
<a href='index.php?name=shop&op=view&id=".substr($ban[$i], 0, 4)."' target='_self'>
или так:
<a href='index.php?name=shop&op=view&id=".substr($ban[$i], 0, -4)."' target='_self'>