Re: Opening a file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Toppage.php -

<?php
include 'Process/order/mypage.php';
if ($a !="Y") {
echo " ";
}
else {
?>
LOTS OF HTML
<?php } ?>

Mypage.php -

<?php
$fruit = echo "apple";
$lines = file("users.txt");
if (in_array($fruit,$lines))
  {
  $a = "Y";
  }
else {
?>
LOTS OF HTML
<?php } ?>

So:
fruits.txt is contained in the same folder as mypage.php.
mypage.php tries to pull the data contained in fruits.txt to see if the data
matches
toppage.php has mypage.php inserted as an include and checks for the result
of $a and processes accordingly.

On 9/5/07, Stut <stuttle@xxxxxxxxx> wrote:
>
> Dan Shirah wrote:
> > I did a
> >
> > if ($lines === false) {
> > echo "lines is false";
> > }
> >
> > like you suggested and it displays that text...but it still make no
> sense.
> > mypage.php and fruits.txt are in the same folder, on the same
> server.  There
> > isn't any permissions issues.
> >
> > So, if mypage.php and fruits.txt are in the same folder, then $lines =
> > file("fruits.txt") should be valid.
>
> Is mypage.php the script you're calling or is it being included from a
> script in a different directory? The 'current directory' is the
> directory of the main script, not included scripts. Use
> dirname(__FILE__) to get the path to the current script.
>
> -Stut
>
> --
> http://stut.net/
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux