Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Samus
Novice


Joined: 01 Jan 2003
Posts: 32

PostPosted: Tue May 11, 2004 12:29 am   

Looping through DB
 
How do you search through the db with a keyword and than that will display a box of every name that it has found and than you click on the name and it will display the whole db record?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue May 11, 2004 2:08 am   
 
You would want to use the %query function to search the DB. Then you would have to get all the records and place the appropiate field into another list for use with %pick. Finally you match the selection with the original query and fetch that record for display with #SHOWDB or #SHOW %expanddb

An example alias of this would be:
#ALIAS SearchDB {DBQuery=%query(%pos("%1",&Keyword));#IF (@DBQuery) {#IF (%numitems(@DBQuery)>1) {DBPick="";#FORALL @DBQuery {#DBGET %i;#ADDITEM DBPick {&Name}};DBUser=%pick("p:Select name","o:1",@DBPick);#DBGET %item(@DBQuery,%ismember(@DBUser,@DBPick))} {#DBGET @DBQuery};#SHOWDB %rec} {#ECHO No such record found}}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net