hansolo Posted January 17, 2013 Share Posted January 17, 2013 Would like to understand the the lower section part of the php code . As this the part which flash is able to read. If follow the link i have placed below. I have outlined the part i like to understand with a red border. ( any tutorials on this lower section of php)thank you http://fav.me/d5rsei0 <?php$nome = "pietro" ;$nick = "lana" ;$mail = "pietro@flash-php.it" ;/*print the variables to the output in order to let flash read them*/$vars = "" ;$vars .= "nome=" . $nome . "&" ;$vars .= "nick=" . $nick . "&" ;$vars .= "mail=" . $mail ;echo $vars ;?> Link to comment Share on other sites More sharing options...
jeffman Posted January 17, 2013 Share Posted January 17, 2013 Read about combined operators (Second example) to understand .= What the code is doing is creating one long string of name-value pairs separated by the & character. Flash or whatever will use the & to distinguish each pair from the others. Link to comment Share on other sites More sharing options...
justsomeguy Posted January 17, 2013 Share Posted January 17, 2013 It's the same format as sending variables in the URL. Link to comment Share on other sites More sharing options...
hansolo Posted January 18, 2013 Author Share Posted January 18, 2013 My first question in this example The ampersand is that a string value or is that to declare a start of anew variable in this example . As an ampersand used in a text editor does declare a new start of a variable . So flash is able to read the start of a new variable. However the qoutations around the ampersand. It could be possible its a string value. As to my understanding in php when a word has qoutations it is to declare a string Link to comment Share on other sites More sharing options...
hansolo Posted January 18, 2013 Author Share Posted January 18, 2013 ok so the ampersand in qoutations if for flash to distinguish the variable from the other variables. As you have explained . So its a similar format to this you tube video . placed below. Does the ampersand need to be within quotations would the value of the ampersand "&" still be read without the qoatations. Link to comment Share on other sites More sharing options...
justsomeguy Posted January 18, 2013 Share Posted January 18, 2013 The entire thing needs to be a string. Like I said, Flash expects variables in the same format as they are sent in the URL. The URL to this page contains this: showtopic=46403&pid=258178&st=0 That's the same format Flash would expect, that would define 3 variables and set their values to the various numbers. The entire thing is a string composed of name/value pairs, each separated with an ampersand. Link to comment Share on other sites More sharing options...
hansolo Posted January 26, 2013 Author Share Posted January 26, 2013 Ive ried this i thought this string value hat would i write just to print something as simple as my name//$name"my name";print the variables to let flash read themname.= "$name =" "my name";echo $name ;?> Link to comment Share on other sites More sharing options...
hansolo Posted January 27, 2013 Author Share Posted January 27, 2013 (edited) Ive pasted how far i am. I have the dynamic text box named and all the files in the correct folder. iWhen i am refering to the php variable iside of flash i have an arrow pointing to show were i belive the name goes... pleae see files there are image description to show the part im not fully understanding. http://fav.me/d5su1axhttp://bobafet1000.d...%253A1359245340 Edited January 27, 2013 by hansolo Link to comment Share on other sites More sharing options...
jeffman Posted January 27, 2013 Share Posted January 27, 2013 I don't do flash, but I do a lot of AJAX. The process looks similar. If I'm right, your PHP script should NOT contain any HTML tags. There should only be the script, so that it only echoes what you need. With the HTML tags and spaces and newlines, all that is getting sent also. Link to comment Share on other sites More sharing options...
hansolo Posted January 27, 2013 Author Share Posted January 27, 2013 (edited) I think this is the correct explanation of the below the first part send the varaibe through as a string value to flash. Then concatenationis used to add the value of the name dannny . Thats why its seperated into parts .i am not saying this true but im hoping after all you help ive finally understand why it splits into two parts. thank you for every one help. ( if i have the explanation wrong please tell me other wise im using a method. I dont fully understand . That could lead to issues later on cheers [AS]$firstName = "danny" ; // sending the variable // this sending varaible name(danny)$aVariable = "&firstName=".$firstName; echo $aVariable[/AS] Edited January 27, 2013 by hansolo Link to comment Share on other sites More sharing options...
hansolo Posted January 30, 2013 Author Share Posted January 30, 2013 $scores ="";while( $row = mysql_fetch_array( $result )){//$scores.=$row['score'];$scores.="&". "=".$row['score'];}echo $scores?>___________________________________________________________________________________ my output now from php below with an ampersand. &=100&=200&=300 ___________________________________________________________________________________ my dynamic table in flash is returned undefined. Not showing the variables // i thought i return the name of the vairiabe below tracing them in flash. returning undefined flash code As2 nameOfText.text = this.scores;trace(_level0.scores);trace(_level0.row); } else { trace (" Error loading variables "); } Link to comment Share on other sites More sharing options...
thescientist Posted January 30, 2013 Share Posted January 30, 2013 (edited) The entire thing needs to be a string. Like I said, Flash expects variables in the same format as they are sent in the URL. The URL to this page contains this: showtopic=46403&pid=258178&st=0 That's the same format Flash would expect, that would define 3 variables and set their values to the various numbers. The entire thing is a string composed of name/value pairs, each separated with an ampersand. Edited January 30, 2013 by thescientist Link to comment Share on other sites More sharing options...
hansolo Posted January 30, 2013 Author Share Posted January 30, 2013 (edited) Thats what i thought i had created here is this not a string .I set the values to variable scores my code$scores.="&". "=".$row['score']; this was my output&=100&=200&=300 this an ampersand i thought "&" Edited January 30, 2013 by hansolo Link to comment Share on other sites More sharing options...
thescientist Posted January 30, 2013 Share Posted January 30, 2013 (edited) NAME/value pairs, just like in his example string The entire thing needs to be a string. Like I said, Flash expects variables in the same format as they are sent in the URL. The URL to this page contains this: showtopic=46403&pid=258178&st=0 That's the same format Flash would expect, that would define 3 variables and set their values to the various numbers. The entire thing is a string composed of name/value pairs, each separated with an ampersand. you only have values Edited January 30, 2013 by thescientist Link to comment Share on other sites More sharing options...
jeffman Posted January 30, 2013 Share Posted January 30, 2013 NAME/value pairs, just like in his example string you only have valuesOr in your case, the result should look something like this: length=100&width=200&height=300 Link to comment Share on other sites More sharing options...
hansolo Posted January 30, 2013 Author Share Posted January 30, 2013 ok so i missing the the value as have the name when you mention the word "pair" what doe that refer to does that mean two of the same $name = "value"/ would a name value pair be the above wriiten twice. Sorry i know this might seem a silly question. $name = "value" . $name = "value" Link to comment Share on other sites More sharing options...
hansolo Posted January 30, 2013 Author Share Posted January 30, 2013 (edited) ok ive seen my mistake about time realy sorry for this guys . I know it must be the longest forumIve been placing the dollar sign in front when the ampersand (&) was needed // right there correctecho ("&Name=$Name"); //what i was doing was this i included the dollar sign at twice . That was creating an errorecho ("&$Name=$Name"); but now i still need to get the value included and somehow surrond the whole thing in string. with the mysq as well The above posts .... Edited January 30, 2013 by hansolo Link to comment Share on other sites More sharing options...
hansolo Posted January 31, 2013 Author Share Posted January 31, 2013 Ive got it now yes . I am only retruning one of the values into flash dynamic textbox. $score = "";while( $row = mysql_fetch_array( $result )){//echo$row['score'];echo "&score". "=".$row['score'];} returns this&score=100&score=200&score=300 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now