Hallo! Selamat Datang di Marketplace produk digital, Freelancer terbaik di indonesia (68833 Members, 786 Products, 5386 Topic, 13072 Comments)

Struktur Organisasi

Dibuat
Login Terakhir 55 Tahun lalu,
Telah Dilihat 2911 Kali
Dadah suranto Mengatakan : Free Account
  1. Ada tutorial buat bikin struktur organisasi dengan datapas mysql ga?
  2. thx

Ada 3 Jawaban

Yakobus sutejo
commented on 06 Jun 2015 21:59:38
  1. Hem saya juga butuh mas Rudy...
Yakobus sutejo
commented on 10 Jun 2015 15:46:20
  1. Haloooooo
Nur hasan
commented on 23 Jun 2015 17:31:03
  1. coba ini, dapat source dari sebelah:
  2.  
  3. <?php
  4. // Mysqlconnection needs to be started before calling the functions. Usage is at the end of the file.
  5.  
  6. function retrieveOrgList($parentid=false) {
  7. $parentid = ($parentid==false)?0:$parentid;
  8. $query = mysql_query("SELECT org.id, org.company_name, rel.superior, userid, us.firstname, us.surname, us.job_title, us.job_role, us.image FROM organisations org, relationships rel, users us WHERE rel.organisationid = org.id AND rel.userid = us.id AND superior = " . $parentid) or die(mysql_error());
  9. $numRows = mysql_num_rows($query);
  10.  
  11. $orgArray = "none";
  12. if ($numRows > 0) {
  13. $orgArray=array();
  14. while ($row = mysql_fetch_assoc($query)) {
  15. $orgArray[$row['company_name']]['id'] = $row['id'];
  16. $orgArray[$row['company_name']]['superior'] = $row['superior'];
  17. $orgArray[$row['company_name']]['userid'] = $row['userid'];
  18. $orgArray[$row['company_name']]['firstname'] = $row['firstname'];
  19. $orgArray[$row['company_name']]['surname'] = $row['surname'];
  20. $orgArray[$row['company_name']]['job_title'] = $row['job_title'];
  21. $orgArray[$row['company_name']]['job_role'] = $row['job_role'];
  22. $orgArray[$row['company_name']]['image'] = $row['image'];
  23. $orgArray[$row['company_name']]['unders'] = retrieveCategoryList($row['userid']);
  24. }
  25. }
  26.  
  27. return $orgArray;
  28. }
  29.  
  30. function displayOrgs($org=false, $charDisp=0) {
  31. if (!$org) {
  32. if ($charDisp != 0) {
  33. $orgs = retrieveOrgList($charDisp);
  34. }else {
  35. $orgs = retrieveOrgList();
  36. }
  37. foreach ($orgs as $org) {
  38. displayOrgs($org);
  39. }
  40. }else {
  41. echo str_repeat("_", $charDisp) . $org['firstname'] . "<br />";
  42. if ($org['unders'] != "none") {
  43. foreach ($org['unders'] as $value) {
  44. displayOrgs($value, $charDisp+1);
  45. }
  46. }
  47. }
  48. }
  49.  
  50. displayOrgs(false, 0);
  51.  
  52. echo "<pre>";
  53. // Lets just pull out a set of organizations.
  54. print_r(retrieveOrgList());
  55.  
  56. /*
  57. insert into `users` (`id`, `firstname`, `surname`, `job_title`, `job_role`, `image`) VALUES (4, 'Hassan', 'Noor', 'hassan.noor', 'Manager', 'manager');
  58. insert into `users` (`id`, `firstname`, `surname`, `job_title`, `job_role`, `image`) VALUES (4, 'Noor', 'Hassan', 'noor.hassan', 'Super visor', 'supervisor');
  59. ?>
Maaf, Untuk Memberikan Komentar Anda Harus Login !!!

Online