The main problem of this thread is moved to here about boolean datatype in PHP / Postgres.
The problem is the conversion of t
and f
to true
and false
, since Postgres stores true
and false
as such.
How can you use the variable a_moderator
in SESSION?
I fetch the value of the variable a_moderator
by
#1 code of how I get the variable
$result = pg_prepare($dbconn, "moderator_check_query",
"SELECT a_moderator
FROM users
WHERE email = $1;"
);
$a_moderator = pg_execute($dbconn, "moderator_check_query", array($_SESSION['login']['email']));
$rows = pg_fetch_all ( $a_moderator );
foreach ( $rows as $row ) {
$_SESSION['login']['a_moderator'] = $row['a_moderator'];
}
I use it unsuccessfully by
#2 code of how I use the variable unsuccessfully
if ( $_SESSION['login']['a_moderator'] == 't' ) {
// do this
}
I also ran unsuccessufully the values such as true
in the place of t
.
The variable in the SESSION has the value f
such that
#3 Output which tells me he value of the varibale
Array ( [login] => Array ( [passhash_md5] => dd2f85814c35fd465c30b1472f5d3af8 [email] => [email protected] [logged_in] => 1 [user_id] => 13 [username] => oeauoeh [a_moderator] => t ) )