Php Mysql Binary tree issue!

Hello guys,
I have created a signup form for registering new account…
on the signup form there is one text box… for entering sponsor id(upline id)…
After inserting the sponsor id that data is inserting into mysql… but the problem is I can’t create a binary tree data…

After signup … user id is generated automatically with sponsor id…
there are two moe fields in database for left and right leg…
but how can i insert the data in binary method… so that i can fetch it proper…

thanks…