Re: noob can't even make a function work right :-(
- From: Stefan Koopmanschap <stefan@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 22 Sep 2005 12:11:03 +0200
woody8624@xxxxxxxxx wrote:
> function makeSure($myFile, $fh, $uName, $pRequest){
>
> if ($uName == ''){
> echo 'You must go back and complete the form to make a request.';}
>
> else {
> $stringData = "$uName<br/>";
> fwrite($fh, $stringData);
>
> $stringData = "$pRequest<hr/>";
> fwrite($fh, $stringData);
> fclose($fh);}}
here you define the function
>
> $myFile = "file.txt";
> $fh = fopen($myFile, 'r');
> $theData = fread($fh, filesize($myFile));
> fclose($fh);
>
> echo "$theData";
and here you never ever call the function. A function should be called,
which is what you seem to forget.
I don't have time to give an example of how you can handle this, but one
of the most important things should be to remove the echo from within
the function to outside the function, and return something from the
function that gives you an idea when you call the function what to do
next. hope this makes sense.
Stefan
.
- Follow-Ups:
- References:
- noob can't even make a function work right :-(
- From: woody8624
- noob can't even make a function work right :-(
- Prev by Date: noob can't even make a function work right :-(
- Next by Date: identify user lan
- Previous by thread: noob can't even make a function work right :-(
- Next by thread: Re: noob can't even make a function work right :-(
- Index(es):
Relevant Pages
|