If highest number show, else?!?
Posted: Sat Jan 31, 2009 8:24 am
This is also for my re-ordering script. I want the highest record to show an arrow down and the lowest record to show an arrow up, and all the records in between to show both a record up and down... I have managed to get the highest to only show a record down, but can't get the lowest to show only a record up... This is what I have done:
Hope somebody can help...
Code: Select all
$i = 0;
$sql2 = $db->sql_query("SELECT *, (SELECT COUNT(uid) AS count FROM ".$prefix."_links WHERE uid=$userid AND catid='$catid' ORDER BY order_no ASC) AS items "
." FROM ".$prefix."_links WHERE uid=$userid AND catid='$catid' ORDER BY order_no ASC");
while ($row2 = $db->sql_fetchrow($sql2)) {
echo '<div class="links"><a href="'.(strstr($row2['url'], 'http') == false ? 'http://' : '').$row2['url'].'">'.$row2['name'].'</a><div id="link-edit">';
if ( $i > 0 ) {
echo '<a href="users.php?ies=LinkReOrder&uid='.$row2['uid'].'&linkid='.$row2['linkid'].'&move=up">';
echo '<img src="images/Aesthetica2-icons/up-10X10.png" alt="'._UP.'" border="0"></a>';
}
echo ' ';
if ( $i < $row2['items']) {
echo '<a href="users.php?ies=LinkReOrder&uid='.$row2['uid'].'&linkid='.$row2['linkid'].'&move=down">';
echo '<img src="images/Aesthetica2-icons/down-10x10.png" alt="'._DOWN.'" border="0"></a>';
}
echo '</div><br></div>';
$i++;
}