-
Print results
Hello, im not sure where to begin, but I have a database with some data in it, and i have a flash mx application that inputs and displays the data.
Im trying to make it display more then 1 result.. how is this completed?
ie I have 3 names..
Steve
Mike
David
it only shows the last 1, how do I get all 3 to display??
Think of is as a chat, in how it displays, and shows new data,etc
I would love to know, thanks in advance.
-Adam!
-
Would I be wrong in thinking it has to do with WHILE and LOOP statements??
Still would like to know, if anyone has a tutorial or a easy explanation. That would be great!
Thanks!
-
Junior Member
You will have to be more specific, what database, what server-side stuff and how is it displayed in Flash?
I assume that your recordset is returning only the one result, in that case, a WHILE loop would be good. In ASP, something like this..
Code:
WHILE NOT rs.EOF DO
name=rs.vchName
WEND
Although that redeclares the variable 'name' on each loop. With a small number of variables I would concatenate the names into a string to send to flash.
Have a look at the tutorials on flash-db.com and aspin.com, for php and asp
Last edited by scudsucker; 07-18-2003 at 10:04 AM.
Hariyemadzisawira nhaka yedu! Down the SCUD and win!
I'm too lazy to read Private Messages.
-
Ok, it's ASP/msSQL, but im fluent in PHP/mySQL so what ever is easiest to explain..
I know how to do recordsets..
I dont think that is the issue, it's how do I display that in flash as multiple entries rather then just the one it shows now?
ex: My sql table consists of this
ID Name
1 Adam
2 Mike
3 Steve
My File Prints like this
In PHP:
echo "&name=$Name&end=1";
Or In ASP:
Response.Write "&name=" & ORs("Name") & "&end=1"
In Flash MX:
Steve
It will only display the "Steve" name, hopefully this makes sense, let me know what im missing.
Do I need to create a recordset, so it would be re-writting that line each time, within the ASP or PHP file..
OR is it something in Flash ActionScript that let's it make a recordset..
Thanks for the help if you have any questions about it ask, I will be online for another 7 hours.. (work)
-Adam
-
Junior Member
I'll only be at work for another 1/2 hr!
If its ASP, that ( unfortunately! ) is my filed of 'expertise' in this company..
Use where you have
Response.Write "&name=" & ORs("Name") & "&end=1"
Code:
WHILE NOT ORs.EOF DO
nameStr=nameStr & ORs("Name") & "°"
ORs.MoveNext
WEND
Esssentially what this does is loop through the database until there are no more records, creating a string that will look like this:
Adam°Mike°Steve°
This can be sent to flash by adding a variable name and an ampersand ('&' signs) at the end, and using Response.Write
Response.Write ("&name=" & nameStr & "&")
Then in the flash your name variable must now be split up into its parts, using
Code:
var nameArr=new Array
nameArr=name.split("°");
And now you can access the data as any array. I use this method for samll amounts of data, if you are planning on loads of names, its better to create an incrementing varaible in the WHILE loop and append it to the varaible name, then send all separately. And i use the ° symbol beacsue it is unusual and easy for me to remember ALT-0176 but anything will do.
Hariyemadzisawira nhaka yedu! Down the SCUD and win!
I'm too lazy to read Private Messages.
-
Ok awesome, thanks alot, that makes perfect sense, do you have another example of incrementing??
Im not sure if I will need it, but it could be useful very soon, and it will save me asking for help on that lol..
thanks alot
I really appreciate it.
-Adam
-
Junior Member
Its pretty simple, too:
Code:
i=1
WHILE NOT ORs.EOF DO
Response.Write("&name" & i & "=" & ORs("Name") & "&"
i=i+1
ORs.MoveNext
WEND
So that one will spit out a length of name/variable pairs, each variable is name1, name2, name3 etc etc
Use POST to load the varaibles, otherwise you will have too much crap!
Hariyemadzisawira nhaka yedu! Down the SCUD and win!
I'm too lazy to read Private Messages.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|