Return to Snippet

Revision: 3067
at May 31, 2007 23:36 by methnen


Initial Code
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'];
	}
}

Initial URL

                                

Initial Description

                                

Initial Title
Related Entries Forwards

Initial Tags
textmate

Initial Language
PHP