database - VB.NET and MySQL query -
how can values mysql database usin while loop?
sry bad english , i'm new in vb.net please not insult me because not know vb.net, i'm trying learn, i'll try explain need. :)
lets go:
we know emailaddress
real email address, first query must
query1 = "select id database.table_users email='" & emailaddress & "'"
now know query1
return value id table_users
. need create new query
query2 = "select friend_id database.table_friends user_id='" & query1 & "'"
okay, query2
return friend_id
table_friends
. 1 more query
query3 = "select displayname database.table_users id='" & query2 & "'"
query3
must return displaynames
of users got in query2
.
example:
first need query id table_users email=emailaddres
need query friend_id table_friends user_id=id
after nedd query displayname table_users id=friend_id
*these examples , not correct can see :d
i need 3 querys in while loop, , last query (displayname) go listbox. while must return mysql values table_friends id= id of emailaddress user.
why loop , why can't make single query below using join
select tf.displayname table_users tu join table_friends tf on tu.id = tf.friend_id , tu.email = '" & emailaddress & "';
Comments
Post a Comment