[WTH] PHP MYSQL Code for Tree /Org Chart Query

Status
Not open for further replies.
Nvm, didn't read it properly
 
Last edited:
Post a few rows from your DB and I'll take a look for you.
 
Post a few rows from your DB and I'll take a look for you.

[TABLE="class: ajax pma_table"]
[TR]
[TH="colspan: 3"][/TH]
[/TR]
[TR]
[TH="class: draggable column_heading pointer marker"]UserName[/TH]
[TH="class: draggable column_heading pointer marker"]Placement[/TH]
[TH="class: draggable column_heading pointer marker"]Position[/TH]
[TD][/TD]
[/TR]
[TR="class: odd"]
[TD="class: data not_null"]Jimmy[/TD]
[TD="class: data not_null nowrap"][/TD]
[TD="class: data not_null"]left[/TD]
[/TR]
[TR="class: even"]
[TD="class: data not_null"]JLO[/TD]
[TD="class: data not_null"]Jimmy[/TD]
[TD="class: data not_null"]left[/TD]
[/TR]
[TR="class: odd"]
[TD="class: data not_null"]Shinobi[/TD]
[TD="class: data not_null"]JLO[/TD]
[TD="class: data not_null"]left[/TD]
[/TR]
[TR="class: even"]
[TD="class: data not_null"]trialuser4[/TD]
[TD="class: data not_null"]JLO[/TD]
[TD="class: data not_null"]right[/TD]
[/TR]
[TR="class: odd"]
[TD="class: data not_null"]donald_duck[/TD]
[TD="class: data not_null"]trialuser4[/TD]
[TD="class: data not_null"]left[/TD]
[/TR]
[TR="class: even"]
[TD="class: data not_null"]minnie_mouse[/TD]
[TD="class: data not_null"]donald_duck[/TD]
[TD="class: data not_null"]left[/TD]
[/TR]
[TR="class: odd"]
[TD="class: data not_null"]mickeymouse[/TD]
[TD="class: data not_null"]donald_duck[/TD]
[TD="class: data not_null"]right[/TD]
[/TR]
[TR="class: even"]
[TD="class: data not_null"]dr_octopus[/TD]
[TD="class: data not_null"]mickeymouse[/TD]
[TD="class: data not_null"]left[/TD]
[/TR]
[TR="class: odd"]
[TD="class: data not_null"]dr_cucumber[/TD]
[TD="class: data not_null"]dr_octopus[/TD]
[TD="class: data not_null"]left[/TD]
[/TR]
[TR="class: even"]
[TD="class: data not_null"]mr_brown111[/TD]
[TD="class: data not_null"]dr_octopus[/TD]
[TD="class: data not_null"]right[/TD]
[/TR]
[/TABLE]


My question is, with such database record, how do I output it out


The html could should look like this if it start from JLO

Js Fiddle >


Also need to assume that the top of tree could be any username and I only need output it branches.


My coding is in PHP and mysql, so its probably a while loop with some logic to draw out the record.

I will be more than willing to pay $15 or so for this code via paypal.
 
Last edited:
updated my question on the last reply. please check.

Offer remain at $15 for anyone who can do this out by php and mysql to output like my database records.

and it should work for n amount of branch.
 
Shoot me your Skype if you have one. I'm pretty tied up right now but I'll message you and see if you still need help when I get some free time.
 
Here you go, just did a recursive function to handle this:

<?php
global $con;
$dbname = "";
$dbuser = "";
$dbpass = "";


$con = mysqli_connect("localhost", $dbuser, $dbpass, $dbname);


iterate("");
function iterate($placement) {
global $con;
$result = mysqli_query($con, "select * from test_users where Placement = '$placement'");
if (mysqli_num_rows($result) > 0) {
echo "<ul>";
while($row = mysqli_fetch_array($result)) {
echo "<li>".$row['UserName'];
iterate($row['UserName']);
}
echo "</ul>";
} else {
//Do Nothing;
}
echo "</li>";
}
mysqli_close($con);
?></li></ul>
 
Last edited:
Here you go, just did a recursive function to handle this:

Give me your paypal detail for this payment ( I testing now ) and skype detail by pm, I got 2nd part to this code which need to be done.

I testing your code now.
 
No prob, sending it now! Let me know how the test goes.
 
Status
Not open for further replies.
This thread has been auto closed due to the forum's thread age policy. Read more.
Back
Top