Skip to content

Instantly share code, notes, and snippets.

@stefanheimes
Last active December 29, 2015 15:59
Show Gist options
  • Save stefanheimes/7694188 to your computer and use it in GitHub Desktop.
Save stefanheimes/7694188 to your computer and use it in GitHub Desktop.
Replace filepath with dbfas id
<?php
$objResult = Database::getInstance()->prepare('SELECT * FROM XXXX') ->execute();
while($objResult->next())
{
$objTlFiles = Database::getInstance()
->prepare('SELECT * FROM tl_files WHERE path=?')
->execute($objResult->image);
if($objTlFiles->numRows == 0)
{
continue;
}
Database::getInstance()
->prepare('UPDATE XXXX SET image=? WHERE id=?')
->execute($objTlFiles->id, $objResult->id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment