Question: Basically, I have been having some trouble with sending a request to a MySQL server and receiving the data back and checking if a user is an Admin or just a User.

Admin = 1
User = 0

```
<?php 
$checkAdminQuery = "SELECT * FROM `users` WHERE `admin`";
$checkAdmin = $checkAdminQuery
mysqli_query = $checkAdmin;

if ($checkAdmin == 1) {
echo '<h1>Working!</h1>';
}else {
echo '<h1>Not working!</h1>'; 
}

?>

```

Sorry that this may not be as much info needed, I am currently new to Stack Overflow.

Answer: 
Firstly, your SQL query is wrong

```
SELECT * FROM `users` WHERE `admin`

```

It's missing the rest of the WHERE clause

```
SELECT * FROM `users` WHERE `admin` = 1

```

Then you're going to need fetch the result from the query results. You're not even running the query

```
$resultSet = mysqli_query($checkAdminQuery)

```

Then from there, you'll want to extract the value. 

```
while($row = mysqli_fetch_assoc($resultSet))
{
    //do stuff
}

```

These are the initial problems I see, I'll continue to analyze and find more if needed.

See the documentation here

<http://php.net/manual/en/book.mysqli.php>
You need to have something like user id if you want to check someone in database. For example if you have user id stored in session

```
<?php
// 1. start session
session_start();
// 2. connect to db
$link = mysqli_connect('host', 'user', 'pass', 'database');
// 3. get user
$checkAdminQuery = mysqli_query($link, "SELECT * FROM `users` WHERE `id_user` = " . $_SESSION['id_user'] );
// 4. fetch from result
$result = mysqli_fetch_assoc($checkAdminQuery);

// 5. if column in database is called admin test it like this
if ($result['admin'] == 1) {
  echo '<h1>Is admin!</h1>';
}else {
  echo '<h1>Not working!</h1>'; 
}
?>

```