how to show selected user to view mysql data

this code showing all MySQL table data to any users but i want only admin and user to show data of mysql query

i have multiple users

1.admin 
2.user123 
3.xyz

so i want only admin and user to show MySQL table data how can i do this

example if admin and user123 open the page then mysql data showing correct if xyz user open the page then it will not showing any data

user login name <?php echo $_SESSION['SESS_FIRST_NAME']; ?>

i want to add this one in to mysql query to showing result only admin and user

          $query = "SELECT * FROM `follower` WHERE `followername` LIKE '".$letter."%' ORDER BY `followername` ASC LIMIT $from, $max_results";

complete code

<?php
$max_results = 10;
$from = (($page * $max_results) - $max_results);


if(empty($_POST)) {
              $query = "SELECT * FROM `follower` WHERE `followername` LIKE '".$letter."%' ORDER BY `followername` ASC LIMIT $from, $max_results";
} 
$result = mysql_query("SET NAMES utf8"); //the main trick
$result = mysql_query($query) or die(mysql_error());
$rows = mysql_num_rows($result);

echo "<table class='gridtable' border='1' cellpadding='0' cellspacing='0'>";
echo "<tr><th>Name</th><th>Company Name</th><th>Mobile No</th></tr>";

if ($rows > 0) {
        while($row = mysql_fetch_array($result)) {
            echo "<tr><td>";
            echo $row['followername'];
            echo "</td><td>";
            echo $row['companyname'];
            echo "</td><td>";
            echo $row['mobileno'];
        echo "</td><td>";
        echo $row['contractdatee'];
            echo "</td></tr>";
        }
} else {
        echo "<tr><td align=\"center\" colspan=\"4\">No results found!</td></tr>";
}

echo "</table>";

// Figure out the total number of results in DB: 
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as followername FROM follower ORDER BY followername ASC"),0);

// Figure out the total number of pages. Always round up using ceil() 
$total_pages = ceil($total_results / $max_results);

// Build Page Number Hyperlinks 
echo "<p class=\"style2\">Pages: ";

// Build Previous Link 
if($page > 1){ 
$prev = ($page - 1); 
echo "<a href=\"".$_SERVER['php_SELF']."?page=$prev&letter=$letter\" class=\"style2\">Previous</a> "; 
}

for($i = 1; $i <= $total_pages; $i++){ 
if(($page) == $i){ 
echo "$i "; 
} else { 
echo " "; 
} 
}


// Build Next Link 
if($page < $total_pages){ 
$next = ($page + 1); 
echo "<a href=\"".$_SERVER['php_SELF']."?page=$next&letter=$letter\" class=\"style2\">Next</a>"; 
} 
echo "</p>";

mysql_close(); 
?>

Answers


Need Your Help

bundle install extensions?

ruby-on-rails

I know there's more than one extension for bundle Install, but what exactly does:

How can I get the source code from a page using javascript

javascript d3.js

I'm trying to get the source code of that page (using js and d3js library)

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.