from this link [Echo problem when a different user logs in](https://stackoverflow.com/q/6247462/749747) that i posted earlier, i managed to do or fix my problem. but somehow, there is a small error that have occurred. although my admin page is working properly, my super admin and other accounts began to output errors (although they are not really error). the employee id and employee name did not echo in the super admin page and other accounts, although the title(file uploaded),file date and status echoed.

```

//what i meant to say was, this is what the echo suppose to look like:
*EmployeeID*     *EmployeeName*     *Title*     *FileDate*     *Status*           

  20132248           Danica          file8     Jan 08, 2001     Approved          
  20896647           Jan             file7     Dec 12, 2000     NotApproved     
  20864125           Keisha          file2     Feb 01, 2000     Approved   
  16521253           Riorei          file10    Mar 20, 2003     NotApproved
                                     file3     Jul 14, 2002     Approved

//instead it echoed like this
*EmployeeID*     *EmployeeName*     *Title*     *FileDate*     *Status*           

                                     file8     Jan 08, 2001     Approved          
                                     file7     Dec 12, 2000     NotApproved     
  20864125           Keisha          file2     Feb 01, 2000     Approved   
                                     file10    Mar 20, 2003     NotApproved
                                     file3     Jul 14, 2002     Approved 

//this is the actual output that appears on my localhost

```

this is the set of codes that i think might have caused the problem,i will put a remark one which if statement the problem i think causes error

```
<?php       
                            $search = '%';
                            $fgmembersite->DBLogin();
                            $limit = 5;
                            if(isset($_GET['offset'])) {
                                $offset = mysql_real_escape_string($_GET['offset']);
                            } else {
                                $offset = 0;
                            }

                            //for namelist a-z
                            $listname = '%';
                            If (isset($_GET['namelist']))
                            {                                   
                                $listname = $_GET['namelist'];
                            }

                            //for search file
                            if(isset($_POST['searchfile']))
                            {
                                $search = $_POST['searchfile'];
                            }                               
                            else if(isset($_GET['searchfile']))
                            {
                                $search = $_GET['searchfile'];
                            }

                            if($_SESSION[$fgmembersite->GetLoginSessionVar()] == 'sa' OR $_SESSION[$fgmembersite->GetLoginSessionVar()] == 'admin')
                            {                                   
                                    //$sql="select * from gmdc_employee where employee_name like '%$search%' AND employee_name like '$listname%' ";                                             
                                            $sql="SELECT `e`.* FROM `gmdc_employee` `e` JOIN `gmdc_user` `u` ON ( `u`.`company_id` = `e`.`company_id` ) WHERE (`u`.`company_name` LIKE '%$search%' OR `e`.`employee_name` LIKE '%$search%' OR `e`.`employee_id` LIKE '%$search%') AND `e`.`employee_name` LIKE '$listname%' ";
                            }
                            else
                            {                                   
                                $sql = "select `e`.* from `gmdc_user` `u`, `gmdc_employee` `e` where `u`.`username` = '".$_SESSION[$fgmembersite->GetLoginSessionVar()]."' and `u`.`company_id` = `e`.`company_id` AND `e`.`employee_name` like '$listname%' AND `e`.`employee_name` like '%$search%'";                                                                                                                                 
                            }

                            $query = mysql_query("$sql ORDER BY `e`.`employee_name`, `e`.`confirmation` DESC ,`e`.`file_id` DESC,`e`.`file_date` DESC  LIMIT $offset,$limit") or die ( mysql_error () );
                            $result = mysql_query($sql) or die (mysql_error());
                            $total = mysql_num_rows($result);
                            $emp_id = "";     //This will be use to remove employee_id if its already echoed.
                            $emp_name = "";   //This will be use to remove employee_name if its already echoed.

                            if(!$result || mysql_num_rows($result) <= 0)
                            {
                                $fgmembersite->HandleError("No file found.");
                                return false;
                            }
                            while ($row = mysql_fetch_assoc($query))
                            {
                                $file_id = $row['file_id'];
                                $file_desc = $row['file_description'];
                                $file_date = $row['file_date'];
                                $file_name = $row['file_name'];
                                $file_accs = $row['folder_access'];
                                $file_employee  = $row['employee_id'];
                                $file_confir = $row['confirmation'];
                                $file_ename = ucwords($row['employee_name']);

                                $emp_id=$emp_id==$row['employee_id']?"":$row['employee_id'];
                                $emp_name=$emp_name==$row['employee_name']?"":$row['employee_name'];

                                $info = pathinfo($file_name);
                                $file_ext = $info['extension'];                                 

                            if($_SESSION[$fgmembersite->GetLoginSessionVar()] == 'sa')
                            {

                                echo '<tr>
                                    <td>
                                        &nbsp; 
                                    </td>
                                    </tr>
                                    <tr class="subone">
                                    <td class="sub" width="100">
                                        '.$emp_id.'
                                        <br />
                                        &nbsp;
                                    </td>';
                                    if($_SESSION[$fgmembersite->GetLoginSessionVar()] == 'sa')
                                    {

                                    ?><td class="sub" width="100">
                                        <a href="" onclick = javascript:newPopup('addfile.php?emp=<?php echo $file_employee ?>');><?php echo$emp_name?></a>
                                        <br />
                                        &nbsp;
                                    </td><?php
                                    }
                                    else
                                        {
                                            echo '<td class="sub" width="182">
                                            '.$emp_name.' 
                                            <br />
                                            &nbsp;
                                            </td>';
                                        }

                                    echo'<td  class="sub" width="218">
                                        <a href="'.$file_accs.$file_name.'" target="_blank" style="text-decoration: underline;">'.$file_desc.'</a>
                                        <br />
                                        &nbsp;
                                    </td>
                                    <td  class="sub" width="100">
                                        '.date('M d, Y',mktime(0,0,0,substr($file_date,5,2),substr($file_date,8,2),substr($file_date,0,4))).'
                                        <br />
                                        &nbsp;
                                    </td>
                                    <td  class="sub" width="100">   
                                                '.$file_confir.'                
                                    <br />
                                            &nbsp;
                                            </td>';
                                    if($_SESSION[$fgmembersite->GetLoginSessionVar()] == 'sa')
                                    {
                                        if($file_confir == 'Pending' OR $file_confir == 'NotApproved')
                                        {                                               
                                            if(isset($_GET['id']))
                                            {
                                                $fgmembersite->Delete_Db($_GET['id']);
                                            }
                                                echo '<td  class="sub" width="100"> 
                                                <a href="index.php?id='.$file_id.'">Delete</a>
                                                <br />
                                                &nbsp;
                                                </td>';
                                        }
                                    }
                                    /
                                    }
//I THINK THE PROBLEM STARTS HERE
                                    else if($_SESSION[$fgmembersite->GetLoginSessionVar()] != 'sa' && ($file_confir == 'Approved' || $file_confir == 'NotApproved'))
                                    {
                                        echo '<tr>
                                    <td>
                                        &nbsp; 
                                    </td>
                                    </tr>
                                    <tr class="subone">
                                    <td class="sub" width="100">
                                        '.$emp_id.'
                                        <br />
                                        &nbsp;
                                    </td>';
                                    if($_SESSION[$fgmembersite->GetLoginSessionVar()] == 'sa')
                                    {

                                    ?><td class="sub" width="100">
                                        <a href="" onclick = javascript:newPopup('addfile.php?emp=<?php echo $file_employee ?>');><?php echo$emp_name?></a>
                                        <br />
                                        &nbsp;
                                    </td><?php
                                    }
                                    else
                                        {
                                            echo '<td class="sub" width="182">
                                            '.$emp_name.' 
                                            <br />
                                            &nbsp;
                                            </td>';
                                        }

                                    echo'<td  class="sub" width="218">
                                        <a href="'.$file_accs.$file_name.'" target="_blank" style="text-decoration: underline;">'.$file_desc.'</a>
                                        <br />
                                        &nbsp;
                                    </td>
                                    <td  class="sub" width="100">
                                        '.date('M d, Y',mktime(0,0,0,substr($file_date,5,2),substr($file_date,8,2),substr($file_date,0,4))).'
                                        <br />
                                        &nbsp;
                                    </td>
                                    <td  class="sub" width="100">   
                                                '.$file_confir.'                
                                    <br />
                                            &nbsp;
                                            </td>';
                                    if($_SESSION[$fgmembersite->GetLoginSessionVar()] == 'sa')
                                    {
                                        if($file_confir == 'Pending' OR $file_confir == 'NotApproved')
                                        {                                               
                                            if(isset($_GET['id']))
                                            {
                                                $fgmembersite->Delete_Db($_GET['id']);
                                            }
                                                echo '<td  class="sub" width="100"> 
                                                <a href="index.php?id='.$file_id.'">Delete</a>
                                                <br />
                                                &nbsp;
                                                </td>';
                                        }
                                    }
                                    }

                                }?>

```

i hope someone could help me figure out what caused this output. :( already spent more that an hour figuring it out. thanks for those that will reply.

MisaChan