function brukerident($bruker_ID){ $uuk = mysql_real_escape_string($_COOKIE["uuk"]); $sql = "SELECT Bruker_id FROM brukere WHERE uuk = '$uuk' LIMIT 1"; $res = mysql_query($sql); // IF THE QUERY SUCCEEDED if ($res) { // THERE SHOULD BE ONE ROW $num = mysql_num_rows($res); if ($num) { // RETRIEVE THE ROW FROM THE QUERY RESULTS SET $row = mysql_fetch_assoc($res); // STORE THE USER-ID IN THE SESSION ARRAY return $row["Bruker_id"]; } }}
I think if the value is varchar insert Bruker_id='$brukerID'
and in your above function why do you are passing parameter $bruker_ID which is not using anywhere in function?
function brukerident($bruker_ID){ $uuk = mysql_real_escape_string($_COOKIE["uuk"]); $sql = "SELECT Bruker_id FROM brukere WHERE uuk = '$uuk' LIMIT 1"; $res = mysql_query($sql); // IF THE QUERY SUCCEEDED if ($res) { // THERE SHOULD BE ONE ROW $num = mysql_num_rows($res); if ($num) { // RETRIEVE THE ROW FROM THE QUERY RESULTS SET $row = mysql_fetch_assoc($res); // STORE THE USER-ID IN THE SESSION ARRAY return $row["Bruker_id"]; } }}
The function returns correctly..
Have tested this by using echo...
Tested the output from the query :
SELECT Navn FROM Kontroller WHERE Bruker_id=K007
And that is correct ?
0
There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will learn the basics of jQuery including how to code hide show and toggles.
Reference your jQuery libraries:
(CODE)
Include your new external js/jQuery file:
(CODE)
Write your first lines of code to setup your site for jQuery…
Learn how to create flexible layouts using relative units in CSS. New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).