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
lucas
Beginner


Joined: 01 Oct 2008
Posts: 16

PostPosted: Mon Jun 22, 2009 1:56 pm   

How to use database in 721?
 
so,
How to use database in 721?

I wirte simple code to query some value, but it does not work!

#DBLOAD quest
#sh %query(&key=@digits_1, value)
#DBCLOSE quest

quest is the db name created in the menu windows->database.
key and value are fields.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Mon Jun 22, 2009 5:58 pm   
 
Couple questions? Is your database successfully loaded? Is the database populated? Remember that you need to have the database window open.

Also the %query command doesn't expand variables so you have to do something like so.
Code:

#sh %query( (%concat( "&key=", @digits_1)), value)


Finally remember ' value' in this example represents the particular database view you want to pull the information from.
_________________
Asati di tempari!
Reply with quote
lucas
Beginner


Joined: 01 Oct 2008
Posts: 16

PostPosted: Tue Jun 23, 2009 8:35 am   
 
I have my database window open.
then use your code,

the result is
0qu|1qu|2qu|3qu

what is wrong with it?
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Tue Jun 23, 2009 2:54 pm   
 
Those are the results of your query i.e. the the ids of the rows (in the quest databaste) that match your digits_1 variable. I'm not sure what you database structure is like so I don't know what other fields are in it. What were you expecting to see?
_________________
Asati di tempari!
Reply with quote
lucas
Beginner


Joined: 01 Oct 2008
Posts: 16

PostPosted: Tue Jun 23, 2009 4:35 pm   
 
hi

the code does work.
#var ttemp
#DBLOAD quest721
#sh %query( (&key=qwe), ALL)
ttemp=%db( %query( (&key=qwe), ALL), key)
#sh @ttemp
#sh in query.....
#DBCLOSE quest721

it prints below:
3qu
qwe
in query.....


thanks Tech!!! Very Happy
You does inspire me!
Reply with quote
lucas
Beginner


Joined: 01 Oct 2008
Posts: 16

PostPosted: Tue Jun 23, 2009 5:10 pm   
 
so,

/*most important thing */

Remember that you need to have the database window open.
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