mysql - SQL Query in PHP not returning expected result -
I am trying to query users' level but I can not return I also tried to do this but I have Try it: This should be returned to the user level. int I am here. I do not know why, because when I get results, it means "1"
function lvl_chcek ($ username) {$ db = new mysqli ('localhost', 'root', 'Root', 'idoctor_db'); $ lvl = $ db- & gt; Query ('Select level is the login from users' ''. $ Username. '' ''); echo $ lvl-> fetch_object () - & gt; Level; Return $ lvl-> fetch_object () - & gt; Level; }
NULL
function lvl_chcek ($ username) {$ db = new mysqli 'localhost', 'root', 'root', 'iddo_db'); $ query = $ db- & gt; Query (user login from 'select level =' '. Username' '' ''); $ Result = mysql_query ($ query); $ Array = mysql_fetch_assoc ($ result); $ Lvl = $ array ['level']; Echo $ lvl; Return $ lvl; }
function lvl_chcek ($ user name) {$ db = new mysqli ('localhost', 'root', 'root', 'idoctor_db') ; $ Query = $ db- & gt; Query ('User login from select level =' '. $ Username' '' 1 '); $ obj = $ query- & gt; Fetch_object (); Return $ obj- & gt; Level; }
Comments
Post a Comment