# HEADER If/ELSE STATEMENTS

**URL:** <https://forum.kirupa.com/t/header-if-else-statements/282342>\
**Category:** programming\
**Created:** [February 20, 2009, 12:59pm UTC](https://forum.kirupa.com/t/header-if-else-statements/282342 "2009-02-20T12:59:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![drummer392](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@drummer392](https://forum.kirupa.com/u/drummer392)\
**Post date:** [February 20, 2009, 12:59pm UTC](https://forum.kirupa.com/t/header-if-else-statements/282342/1 "2009-02-20T12:59:20Z")

</div>

Hi There,

I am having trouble with my if/then elseif/then statements. The code below if on all of my pages as a header, and what it does is shows the user their header based on who they are. The info is being processed from a row in the database table called “is\_admin”. What I want to happen is that if you are a 0(basic user) you will see “header.php”. 1(admin) you will see “header\_admin.php”, and 2(client) see the client\_header.php.

The code just isn’t working right. It is showing the admin user as a 0, and the basic user as a 1. I don’t know what to do. Any suggestions?!?!

```php
$is_admin = false;
 
$sql = "SELECT is_admin FROM users WHERE username='".$usernamelog."' and password='".$passwordlog."' LIMIT 1";
$checkquery = mysql_query( $sql );
$data = mysql_fetch_array( $checkquery );

if ( $data['is_admin'] == 0 ) {
include_once('header.php');
}
else if ( $data['is_admin'] == 1) {
include_once('header_admin.php');
} 
else if ( $data['is_admin'] == 2) {
include_once('client_header.php');
}
 

```
