Actually, you probably could write:
<?php
include 'connection.php';
mysql_query("UPDATE items, backup SET items.name=backup.name WHERE items.id=backup.id");
?>
This would be more efficient than executing updates in a loop, especially since you do not wrap the updates in a transaction. From what I understand, it would also avoid a race condition.