Posted By

methnen on 05/31/07


Tagged

textmate ee related fields forwards


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

basicmagic


Related Entries Forwards


 / Published in: PHP
 

  1. global $DB;
  2.  
  3. $rel_weblog_id = '4';
  4. $rel_field_value = '{rel_field}';
  5.  
  6. $sql = "
  7. SELECT *
  8. FROM exp_relationships
  9. LEFT JOIN exp_weblog_data, exp_weblog_titles
  10. ON (
  11. exp_weblog_data.entry_id = exp_relationships.rel_child_id
  12. AND exp_weblog_titles.entry_id = exp_relationships.rel_child_id
  13. )
  14. WHERE exp_relationships.rel_id = '$rel_field_value'
  15. AND exp_weblog_titles.weblog_id = '$rel_weblog_id'
  16. ";
  17.  
  18. // Query for rel_child_id in the exp_relationships table
  19. $rel_data_query = $DB->query($sql);
  20.  
  21. if($rel_data_query->num_rows > 0)
  22. {
  23. foreach($rel_entry_query->result as $row)
  24. {
  25. $entry_id = $row['entry_id'];
  26. $title = $row['title'];
  27. }
  28. }

Report this snippet  

You need to login to post a comment.