Question: Alright, I'm pretty desperate. This is my first time using StackOverflow (I've always find all my answer but not this time). Please Community I need your help cause I'm not a SQL wiz. (I'm using Access).

I have 3 tables "User", "Type" and "User\_update". I want to get the value from the "User" table but if there's an update for that user in the "User\_update" table I would like to have the value from the "User\_update" table instead and the date of the update. :-/

```
TABLE "USER"
id | user | type_id
--------------------
0  | bibi | 1
1  | toto | 1

TABLE "TYPE"
id | type
-----------
0  | admin
1  | normal

TABLE "USER_UPDATE"
id | user_id | type_id | date
-----------------------------------
0  | 1       | 0       | 9/3/2015

```

Would like to get something like this:

```
user | type   | date
--------------------
bibi | normal | 
toto | admin  | 9/3/2015

```

Hope you guys can help!

Answer: 
First check that the `session_start();` is added on your first line of your file. Then put the below code.

```
<?php if($_SESSION['usr'] == 'xyz'){
    //Put the buttons which you want to display on when the use is XYZ.
} else {
    //Put the buttons which you want to display on when the use is ABC.
} ?>

```
When you bind your onclick listener, you need to check if the element exists. You can do this like this:

```
if ( $( "#estimate" ).length ) {
    //Add your onclick here
}

```

The length attribute of the query gives the amount of elements which are returned by the query, if this is 0 (so no element with id `estimate`) it will skip the if.