Toon posts:

PHP-vraagje, makkie voor jullie!!

Pagina: 1
Acties:
  • 62 views sinds 30-01-2008

Verwijderd

Topicstarter
Hallo mensen, vast een makkelijk vraagje voor jullie, maar ik ben pas een php-beginneling, ben nu dus php aan het leren, ik geloof dat ik het wel snap maar het lukt niet:
[stukje script]
<?php
$filename = "/php/counter.dat";
if(file_exists($filename)) {
$file = fopen("$filename", "r") ;
$count = fgets($file, 50);
fclose($file);
}
$count = $count + 1;
$file = fopen("$filename", "w") ;
fputs($file,$count,50);
fclose($file);
[/stukje script]

Maar wat moet er nu bij filename komen te staan, en moet ik zelf een bestandje maken dat counter.dat heet, of hoe werkt dit.

En nog een vraag, dit moet dus als onderdeel van een frame geladen worden, hoe doe ik dat,

[nog een stukje script]
<frame name="taal" src="language.php3" marginwidth="0" marginheight="0" scrolling="no" frameborder="no" frameborder="0" framespacing="0" border="0">
[/nog een stukje script]

  • LuCarD
  • Registratie: Januari 2000
  • Niet online

LuCarD

Certified BUFH

<?php
$filename = "/php/counter.dat";
if(file_exists($filename)) {
$file = fopen("$filename", "r") ;
$count = fgets($file, 50);
fclose($file);
}
$count = $count + 1;
$file = fopen("$filename", "w") ;
fputs($file,$count,50);
fclose($file);

Maar wat moet er nu bij filename komen te staan, en moet ik zelf een bestandje maken dat counter.dat heet, of hoe werkt dit.


Lees zelf maar uit de handeleiding van PHP functie fopen:<BLOCKQUOTE><font size=1 face=Verdana, Arial, Helvetica>quote:</font><HR>'r' - Open for reading only; place the file pointer at the beginning of the file.

'r+' - Open for reading and writing; place the file pointer at the beginning of the file.

'w' - Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.

'w+' - Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.[/quote]En nog een vraag, dit moet dus als onderdeel van een frame geladen worden, hoe doe ik dat,

<frame name="taal" src="language.php3" marginwidth="0" marginheight="0" scrolling="no" frameborder="no" frameborder="0" framespacing="0" border="0">


Dit moet in een frameset komen te staan.

Programmer - an organism that turns coffee into software.


Verwijderd

Cross posting :(
gathering.tweakers.net/showtopic/49222

Afbeeldingslocatie: http://gathering.tweakers.net/i/2.gif
Deze dicht, die andere dicht, of allebei dicht.

Dit topic is gesloten.