php - How do I set the SESSION in function, to use this SESSION everywhere? This isn't working -
I have a problem with a session inside the itemprop = "text">
itemprop = "text">
function
I $ _SESSION ['idUser'] = How to set a $ [idUser] result; For a session, which I can use for upcoming activity.
& lt ;? Php // session session_start (); Class DB_Functions {public function getUserByEmailAndPassword ($ email, $ password) {$ result = mysql_query ("Select * from user to email address = '". $ Email ""' ") or die (mysql_error ()); // Check for $ no_of_rows = mysql_num_rows ($ result); If ($ no_of_rows & gt; 0) {$ result = mysql_fetch_array ($ result); // This is the session that I want to use $ _SESSION ['idUser'] = $ result ['idUser']; Return result;
Believing it's just a snippet of a large square, I have no reason That's why this line:
$ _ session ['idUser'] = $ result ['idUser']; Will not work again (assume that the $ result [idUser '] has a value). Make sure you have session_start (); called on all pages; are those that you want to use global session variables.
Comments
Post a Comment