Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Displaying data from ASP page

I have an asp page that queries a database and stores the data as variables. I am then passing those variables (name & email) to a flash file.

I have buttons that navigate through the records - however, when the flash file comes across a record from the database that has an empty field (ie. the name field has something in it, but the corresponding email field is blank) it displays the email field from the previous record, rather than leaving it blank.

Any ideas how to get round this?

thanks
0
arghh
Asked:
arghh
2 Solutions
 
RounehCommented:
My guess is that flash is interpreting empty variables as follows: "No data in that variable? I'll just leave it alone then". This means you'll have to either send a blank space where the fields are empty, or reset the variables in your flash to "" before you run loadVariables().


Hope this helps.

Regards,
Rouneh.
0
 
henrywwCommented:
it depends on how u get ur variables from the asp file

if u are using loadVariables u will have the asp out as

'asp
while not rs.eof
   cnt = cnt + 1
   response.write ("name" & cnt & "=" & rs("name") )
   ... ... ..
   ... .. ..
wend

'the out is something like the following

name1=someone&email1=abc@domain.com&name2=another&email2=&name3=myName&email3=email@damin3.com ... etc

in ur flash, how do u eval the loaded variables?

i am only guessing ...
if u have something like the following...

//flash action script
..
rec_id = 2
..
inputEmail = eval("email" + rec_id);
if (inputEmail != null) {
  display_Email = inputEmail;
}
..
..

that way the last email is still in display_email ...
instead ...

if (inputEmail != null) {
  display_Email = inputEmail;
} else { //missing this else????
  // show empty
  display_Email = "";
}

hope this helps.

it will much easier to find out if u can post ur code in the asp & the flash


cheers
0
 
jcoriCommented:
I'm doing a news/tour date admin for a band website.  When passing the fields out of flash, i load the text fields into the LoadVars Object and call a function:

_root.loadvarsobjectname.name = setEmpty(thisTextField);

function setEmpty(thisText){
   if(thisText == ""){
      thisText = "EMPTYDATA";
   }
    return(thisText);
}

function checkEmpty(thisText){
   if(thisText == "EMPTYDATA"){
       thisText = "";
   }
   return(thisText);
}

so if the text field that's being sent out is empty, it replaces it with EMPTYDATA and writes it to the MySQL database (in my case through PHP, but that makes no difference).  Then when the information is brought back into flash (either in the actual band website, or the admin app) I call the checkEmpty function to check for EMPTYDATA and replace it with "".  That might be easier than rewriting all your scripts if/when you change the format of your database.
0
 
elhyCommented:
I've encounter this problem before and I tried checking for not null and empty string (""). But both way didn't work out for me (till now still don't know why). I've thought of icori's idea but I do not want to change the data in the database just in case something went wrong. These things can't be played around with in live data if you can what I mean.

So what's my solution? Here it is:


myEmail = email; //email is the variable passed to flash.
if (String(myEmail).length != 0) {
  emailField = myEmail;
}else{
  emailField = "";
}
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now