Variables in DB-Query - Random Records - 3/17/2001 20:32:00
Hi thereI've been browsing and trying but couldn't find a solution. I have some twelve records (will slowly increase over time) and I would like to pull out 4 to 5 random records and display a field. First I have setup the query with FP2K and just got all records. Then I limited the query to only get a couple of rows back, using the WHERE INDEX IN (X, Y, Z). This also worked fine. 'SELECT * FROM "table_name" where index in (1,3,4,7,11)' Then I've created a variable that should replace the '(X, Y, Z)' in my query, which also worked fine. See the code below: <% Dim marray Randomize Timer marray = Int(RND * 12) & ", " Randomize Timer marray = marray & Int(RND * 12) & ", " Randomize Timer marray = marray & Int(RND * 12) & ", " Randomize Timer marray = marray & Int(RND * 12) & ", " Randomize Timer marray = marray & Int(RND * 12) & ", " Randomize Timer marray = marray & Int(RND * 12) & ", " Randomize Timer marray = marray & Int(RND * 12) response.write marray %> But now I'm completely lost. I have no clue how I could replace the constant values with my variable 'marray' in the query. I've managed to use a search form and fill the form field with the variable. But then, I always have to click first on the 'Submit' button before the results are shown. I'm using the FP Database wizard, cos I'm not too good at .asp and the best I can do is to tweak around some existing code. I'd highly appreciate some help. Thanks a lot in advance for any hint.
|