mysql - How to retrieve a specific data from database in ASP and put that data in a variable -
problem: have database called admin has id, username , password column. need put id in variable called dim id specific username.
if run query:
adors.source = "select * admin username= '"& username &"' , password ='"& password &"' " i particular row in database , particular id. so, problem how retrieve id above query , put in declared variable called id
one particular solution using while loop shown below:
col1 = adors.fields("id") id = col1 adors.movenext loop while not adors.eof since have 1 piece of data in col1 variable, nicer if skip do while process. question how retrieve data , put data in id variable without using while loop statement.
when using ado recordset, if want value, can grab value.
id = adors.fields("id").value if admin table going have more 1 row same username , password, have problems elsewhere, want either send whatever you're doing id off method, or load of id's array.
if there more handful, getrows method may useful well.
(and, really, shouldn't select * if want id. select id admin should work fine. , sanitize user , password when build sql string. consider using command object. , don't store password, store hash of password. , eat vegetables.)
Comments
Post a Comment