php - How can i set session data to specific item from array -
this tried:
$id = mysql_query("select userid members username='".$gebruikersnaam."'"); $_session["id"] = (string)$id; var_dump($_session)
with result this:
array[1] { ["id"]=> string(15) "resource id #14"}
instead of actual string value
the mysql_query function returns resource. need fetch row resource. have info want in it.
$username = mysqli_real_escape_string($link, $unescapedusername); $result = mysqli_query($link, 'select userid `members` username = "' . $username . '"'); // ^ result resource $row = mysqli_fetch_assoc($result); // ^ row has array $_session['id'] = $row['userid'];
an has said, don't utilize mysql_* functions anymore.
php mysql arrays session
No comments:
Post a Comment