Return to Help Center

Welcome to the Bravenet Help Forums. Here you can chat and meet other Bravenet Members. Please do not post advertisements.

Forum: Coding Discussions
Start a New Topic 
Sessions and Calling with PDO

I am not new to coding, but with the upgrades from mysql to mysqli or PDO I am very confused. I tried to convert to the mysqli but it didn't work at all, so I chose PDO which at least gets the information into the database. The issue I am now having is setting up SESSIONS so that only certain pages are visible to certain people.

Assuming that I know how to set up a db connect, and that the code for such is correct,
and assuming that the information is correctly inserted into the database, the code I am trying to call is defined as $userDetails but there is something definitely wrong with the way I am calling it.

This is how the userDetails is defined.

public function userDetails($uid)
$db = getDB();
$stmt = $db->prepare("SELECT email,username,name,user_rank FROM users WHERE uid=:uid");
$stmt->bindParam("uid", $uid,PDO:<img src="//" border="0" alt=""> ARAM_INT);
$stmt->bindParam("user_rank", $uid,PDO:<img src="//" border="0" alt=""> ARAM_INT);
$stmt->execute(array(':uid'=>$uid, ':user_rank'=>$user_rank));
$data = $stmt->fetch(PDO::FETCH_OBJ);
return $data;
catch(PDOException $e) {
echo '{"error"<img src="//" border="0" alt=""> "text":'. $e->getMessage() .'}}';

single line of code to call it to a function
<?php if($userDetails['uid']=$uid && $userDetails['user_rank']=$admin); { ?>

but it doesn't work like expected.

Anyone else having issues like this, or can offer any help on how to do this. I have been reading for 2 weeks and am at my wits end.