I am using the php array_multisort function to sort an array of flexinodes with sticky's at the top, then the first flexinode field below that, followed by the second flexinode field. Everything sorts fine, except the sticky's, which end up at the bottom.
The sticky's are returned at the top from the database query, but I don't think I giving the propert name for the sticky element to the array_multistort (currently I am referring to it as $row['sticky']). This appears to be where the problem is. What name would one use to access this element?
<?php
$list_length="10";
$term_id = "7";
$sql="SELECT n.nid FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid = $term_id ORDER BY n.sticky DESC, n.title DESC";
$sql_count="SELECT COUNT(DISTINCT(tn.nid)) FROM {term_node} tn WHERE tn.tid = $term_id";
$result = pager_query($sql, $list_length,0,$sql_count);
$x=0;
while ($node = db_fetch_object($result)) {
$inarr[$x]=$node;
$x++;
}
foreach ($inarr as $key => $row) {
$stick[$key] = $row['sticky'];
$number[$key] = $row['flexinode_17'];
$part[$key] = $row['flexinode_18'];
}
array_multisort($stick, SORT_DESC, $number, SORT_DESC, $part, SORT_DESC, $inarr, SORT_DESC);
for ($y=0;$y<$x;$y++) {
$outnode=$inarr[$y];
$output .= node_view(node_load(array('nid' => $outnode->nid)), 1);
}