All pastes #2073821 Raw Edit

Stuff

public text v1 · immutable
#2073821 ·published 2011-06-02 19:25 UTC
rendered paste body
<?php
include_once('includes/bootstrap.inc');
error_reporting(E_ALL & ~E_NOTICE);
// let's bootstrap: we will be able to use drupal apis
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$db = db_query("SELECT content_type_video.nid,content_type_video.field_video_convert_fid, files.filepath
FROM content_type_video
LEFT JOIN node ON content_type_video.nid = node.nid
LEFT JOIN files ON content_type_video.field_video_convert_fid = files.fid
WHERE node.created > 1302459704 AND content_type_video.field_video_convert_fid IS NOT NULL ");
while ($row = db_fetch_object ($db)) {
$filename = explode(".", $row->filepath);


$thumbname = $filename[0].".jpeg";
//echo $thumbname;
print ("SELECT files.fid from files  WHERE filepath = ".$thumbname);
$q = db_query("SELECT files.fid from files  WHERE filepath = '%".$thumbname"%'");
while ($rown = db_fetch_object ($q)) {
//print("SELECT files.fid WHERE filepath = $thumbname ");
echo $rown->fid."------";
db_query("update content_type_video set field_thumbnail_fid = $rown->fid WHERE nid = $row->nid");
}
}
?>