Return value on condition failing in PHP -
If the query fails then I need a wrong return ... where do I keep it ... < / P>
function ass ($ username, $ password) {$ qry = "Member from WHOE login = '$ usernamename' and passwd = '". Select from MD5 ($ password). $ Result = mysql_query ($ qry); While ($ line = mysql_fetch_array ($ result)) {returns (array ($ line ['uservelle'], $ line ['email'])); } // return 'invalid user name / password'; }
False Return on Failed, Just Like Therefore, your code should be as follows:
function asas ($ user name, $ password) {$ qry = "select from member WHERE login = '$ user name' and passwd = '' $ (= $ Password) "." $. $ Result = mysql_query ($ qry); // If the failure of the mysql connection is intended, return (! $ Results) return false; $ line = mysql_fetch_array ($ result) ; If ($ line) return array ($ line ['userlevel'], $ line ['email']); // If unsuccessful intention is to return the username and password return false Eats o;}
You will notice that in many exit point homework function you should focus on the same.
Comments
Post a Comment