<?php
$link = mysql_connect($server,$username,$password);
mysql_select_db($database);
$query = "SELECT table2.name, table2.link_id FROM table2 INNER JOIN (SELECT link_id FROM table1 ORDER BY table1.date DESC LIMIT 15) AS table2_alias USING (link_id) ";
$result=mysql_query($query, $link);
if( $result ) {
$num=mysql_numrows($result);
for($i=0; $i<$num; $i++) {
$name=mysql_result($result, $i, "name");
$link_id=mysql_result($result, $i, "link_id");
echo '<a href="index.php?option=com_mtree&task=viewlink&link_id='.$link_id.'&Itemid=26">'.$name.'</a><br/>';
}
} else {
echo "Result is not valid<br/>";
}
mysql_close();
?>
$link = mysql_connect($server,$username,$password);
mysql_select_db($database);
$query = "SELECT table2.name, table2.link_id FROM table2 INNER JOIN (SELECT link_id FROM table1 ORDER BY table1.date DESC LIMIT 15) AS table2_alias USING (link_id) ";
$result=mysql_query($query, $link);
if( $result ) {
$num=mysql_numrows($result);
for($i=0; $i<$num; $i++) {
$name=mysql_result($result, $i, "name");
$link_id=mysql_result($result, $i, "link_id");
echo '<a href="index.php?option=com_mtree&task=viewlink&link_id='.$link_id.'&Itemid=26">'.$name.'</a><br/>';
}
} else {
echo "Result is not valid<br/>";
}
mysql_close();
?>