kmkmkm
kmkmkm

Reputation: 79

I'm having issues with displaying this value from the database

...while connecting 2 table variables for use.

Here is what I have for query:

 //GRABBING USER ID
 if (isset($_SESSION['login_email'])) {
    $session_entry = $_SESSION['login_email'];
    $user_query = mysqli_query($connection, "SELECT id FROM users WHERE email = '$session_entry'");
    $user_assoc = mysqli_fetch_assoc($user_query);
    $user_id = $user_assoc;
 }

  //GRABING ACCESS ID
  if (isset($_SESSION['login_email'])) {
    $access_query = mysqli_query($connection, "SELECT access FROM user_access WHERE user_id = '$user_id'");
    $access_assoc = mysqli_fetch_assoc($access_query);
    $access = $access_assoc;
 }

and the $access echo's "Array"... Don't know what to do about it.

Right now, in my user_access table I have 2 columns: 1. user_id and 2. access

I want it to echo out the access code, but like said above, all I get is "Array".

I attend on using this for the purpose of giving users access codes for accessing specific webpages that they have permission to access through these codes.

Upvotes: 0

Views: 27

Answers (1)

bansi
bansi

Reputation: 57052

$access = $access_assoc;

must be

$access = $access_assoc['access'];

Also

$user_id = $user_assoc;

must be

$user_id = $user_assoc['id'];

Check mysqli_fetch_assoc Manual

Upvotes: 1

Related Questions