MYSQL_GETUSERID gets the user ID number corresponding to the given user name. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: MYSQL_GETUSERID gets the user ID number corresponding to the given user name. CALL: userid = mysql_getUserID(conn, username) VERSION: $Id: mysql_getUserID.m,v 1.4 2007/08/31 17:29:22 hewitson Exp $ HISTORY: 24-05-2007 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function [userid,dbuser] = mysql_getUserID(conn, username) 0002 % MYSQL_GETUSERID gets the user ID number corresponding to the given user name. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: MYSQL_GETUSERID gets the user ID number corresponding to the 0007 % given user name. 0008 % 0009 % CALL: userid = mysql_getUserID(conn, username) 0010 % 0011 % VERSION: $Id: mysql_getUserID.m,v 1.4 2007/08/31 17:29:22 hewitson Exp $ 0012 % 0013 % HISTORY: 24-05-2007 M Hewitson 0014 % Creation 0015 % 0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0017 0018 q = sprintf('select userid from users where username="%s"', username); 0019 curs = exec(conn, q); 0020 curs = fetch(curs); 0021 userid = curs.Data{1}; 0022 close(curs); 0023 0024 % END