/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
global $DB; $rel_weblog_id = '4'; $rel_field_value = '{rel_field}'; $sql = " SELECT * FROM exp_relationships LEFT JOIN exp_weblog_data, exp_weblog_titles ON ( exp_weblog_data.entry_id = exp_relationships.rel_child_id AND exp_weblog_titles.entry_id = exp_relationships.rel_child_id ) WHERE exp_relationships.rel_id = '$rel_field_value' AND exp_weblog_titles.weblog_id = '$rel_weblog_id' "; // Query for rel_child_id in the exp_relationships table $rel_data_query = $DB->query($sql); if($rel_data_query->num_rows > 0) { foreach($rel_entry_query->result as $row) { $entry_id = $row['entry_id']; $title = $row['title']; } }