0
我試圖讓這個工作和查詢執行,但沒有回來。我試過了我能想到的一切,你能發現我做錯了什麼嗎?Drupal db_query_range SQL查詢
$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>";
}
編輯 - 我整理了幾位,但輸出仍然是空的!
編輯 - 這是工作代碼:
$nodeid = $node->nid;
$get_image = db_query('
SELECT p.filepath as imagefilename
FROM {image_attach} i
LEFT JOIN {image} a ON i.iid = a.nid
LEFT JOIN {files} p ON a.fid = p.fid
WHERE i.nid = %d AND p.filename = "recipe_thumb"', $nodeid);
$obj_image = db_fetch_object($get_image);
$imagefilename = $obj_image->imagefilename;
嗯......也許有東西在SQL ..我非常想放棄的Drupal DAL,只是做在純PHP/SQL tbh! – MrFidge 2010-03-26 14:11:11
hiya - 得到它的工作,感謝您的對象提示:) – MrFidge 2010-03-29 16:28:29