Mysql How to sort row ORDER BY other row of record?

My database tbl_user has the following columns :
image (42)

$user_id = 2;

$user_tree = $this->getAllRec(“u.user_id”,

“tbl_user u”,

“WHERE u.Upline = '”.$user_id."’

ORDER BY Right_id ASC");


I want the array $user_tree to hold (user_id 5) first, then (user_id 6), how to do that?

I want to print (Left_id) first, then only print (Right_id). May I know how to do it?

Not sure what your function call does, but, results from a query is an array.
It does not matter what the array holds. Just get the ASSOC version.
Then, print it as you need like echo $user_tree[“Left_id”] . " - " . $user_tree[“Right_id”] . “
Or something like that… Really not sure what your question is.

Sponsor our Newsletter | Privacy Policy | Terms of Service