database query

Jan Schenkel janschenkel at yahoo.com
Tue Oct 21 07:21:25 EDT 2003


--- Toma Tasovac <ttasovac at princeton.edu> wrote:
> hello.
> 
> i've started learning how to use rev with mySQL
> today -- it's very 
> exciting.  the database query builder is easy enough
> and i had no 
> problems displaying the contents of the entire
> record set in the field 
> -- but i'm having difficulties going beyond the
> query builder.
> 
> could some kind soul tell me how to implement a
> simple query in a rev 
> text field on mouseUp
> 
> SELECT * FROM dictionary WHERE word = "blahblah"
> 
> where "blahblah" is the clickText ?
> 
> muchas gracias.
> 
> T.
> 
> 

Hi Toma,

If you're already using database linked fields, then
here's another trick to make dynamic queries:

1) Add another query to the same database, let's call
it "DynamicDictionaryQuery"

2) Add your fields for the dynamic dictionary info,
and link them to this query
(Hint: you can use a 'table' field if you like to see
everything in a single field)

3) Now set the script of the field on which the user
can click to :
on mouseUp
  -- build our new dynamic query
  put "SELECT * FROM dictionary WHERE word='" & \
     the clickText & "' ;" into tSQLQuery
  -- now update our dynamic query
  revSetSQLOfQuery "DynamicDictionaryQuery", \
     tSQLQuery
end mouseUp

Now when you click on a word in the field, the
dynbamic query will be updated and the controls linked
to it will be refreshed at the same time.

Hope this helped,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com


More information about the Use-livecode mailing list