Drupal db_query_range sql query

Posted by hfidgen on Stack Overflow See other posts from Stack Overflow or by hfidgen
Published on 2010-03-26T11:24:26Z Indexed on 2010/03/26 13:03 UTC
Read the original article Hit count: 382

Filed under:

Hiya,

I'm trying to get this working and the query executes but nothing comes back.. I've tried everything I can think of, can you spot what I'm doing wrong?

Thanks in advance!

$nido = $node->nid;
$result = db_query_range('
        SELECT i.nid, i.iid, a.fid, p.filename, p.filepath
        FROM {drup_image_attach} i 
        LEFT JOIN {drup_image} a ON i.iid = a.nid 
        LEFT JOIN {drup_files} p ON a.fid = p.fid 
        WHERE i.nid = %d AND p.filename = "recipe_thumb"', $nido, 0, 10);
echo "Filepath = " . $result ->filepath. "<br>";
echo "Filepath = " . $result ->filename . "<br>";
echo "IID = " . $result ->iid. "<br>";
echo "NID = " . $result ->nid . "<br>";
}

EDIT - sorted out a couple of bits, but the output is still empty!

© Stack Overflow or respective owner

Related posts about drupal-6