Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Created by PhpStorm.
- * User: apelmahmud
- * Date: 02/04/2017
- * Time: 3:24 PM
- */
- $serverName = 'localhost';
- $userName = 'root';
- $pass = '';
- $dbname = 'HR';
- $name ="orko";
- $con = new mysqli($serverName,$userName,$pass,$dbname);
- if($con->connect_error){
- die("connect fail");
- }
- // $sql = 'select * from employees where employee_id = 3000';
- function tree($parent){
- global $con;
- $sql = "select * from employees where manager_id =$parent";
- $result = $con->query($sql);
- while ($row = $result->fetch_assoc()) {
- echo $row['EMPLOYEE_ID']." ".$row['FIRST_NAME']."<br>";
- tree($row['EMPLOYEE_ID']);
- }
- }
- tree(3);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement