Welcome, Guest. Please login or register.
Did you miss your activation email?
05/21/12, 04:34
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Server side Scripting and Database Support
| |-+  PHP, Perl, ASP, JSP, CFM (Moderators: Flash-db, Musicman, vesa kortelainen, Ronald Wernecke, Jorge Solis, nothingGrinder)
| | |-+  $fp = fopen(position.txt,"w+");
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: $fp = fopen(position.txt,"w+");  (Read 2252 times)
till
Seasoned Programmer
***
Posts: 200



View Profile WWW Email
« on: 08/18/02, 15:14 »

hi this is till again.!

i have a question about the following:


<?
$NewPositions = "Objectx=$delta_x&Objecty=$delta_y";

   $fp = fopen(position.txt,"w+");
   fwrite($fp, $NewPositions, 800);
   fclose( $fp );
   $result=" neue Position gespeichert ";

    print "&result=".$result;

?>

fla:

loadVariablesNum("position.txt?Ran="+random(999), 0)

thats how it works i thought.

BUT: on calling php , it creats a new file : positiontxt (datei)(witout ".")

so i  chanched the fla to:  loadVariablesNum("positiontxt?Ran="+random(999), 0)

it works. but i dont understand why.

till.


Logged
Musicman
Administrator
Systems Administrator
*****
Posts: 2685



View Profile WWW Email
« Reply #1 on: 08/18/02, 16:45 »

Hi,

you should have written "position.txt" or 'position.txt' in your code.
Also, change the w+ into w - there is nothing in your code using the + part anyway

Musicman
Logged
till
Seasoned Programmer
***
Posts: 200



View Profile WWW Email
« Reply #2 on: 08/19/02, 00:42 »

hi musicman!

thats the reason why im asking.
the example saves the new position in a text file. its only a part of whole.
every new position will be wrote in the textfile and delet the old one.


but when i use      position.txt       the php creates  positiontxt.dat      ( or              something)  

and the position.txt is not in use;


thats why i chanched the fla also. why does it work like this?
i tried   r+   and  a+ .
i wanted to use        position.txt         but php ignores it and creates positiontxt.
understandable?

till
Logged
Musicman
Administrator
Systems Administrator
*****
Posts: 2685



View Profile WWW Email
« Reply #3 on: 08/19/02, 03:17 »

Hi,

the filename is, technically, a string constant - that is why you should write it in quotes.
It is very similar to the
"result=" or "neue Position gespeichert"
pieces in your code.
All of the + file modes deal with reading and writing the same file _during the same script_; your code is just writing the file, and either a different script or an swf will read the file at a later time.
You should use just "w" for writing

Musicman
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #4 on: 08/19/02, 09:12 »

Hi,
just to explain, why the dot gets lost:

If you don' write a dot inside quotes, it means in php "concatinat two strings together".
Thats why!
Logged

happy flashing
Cool
Ronald
till
Seasoned Programmer
***
Posts: 200



View Profile WWW Email
« Reply #5 on: 08/19/02, 11:06 »

hi roland, musicman !

some stupid moments;
but igot it in the end.
thanks.
till.
« Last Edit: 08/19/02, 11:11 by till » Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!