Re: Re[4]: [PHP] erge on a text file

From: Date: Mon, 11 Sep 2000 01:12:10 +0000
Subject: Re: Re[4]: [PHP] erge on a text file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-16100@lists.php.net to get a copy of this message
On Sun, 10 Sep 2000, Richard Kurth wrote: > I changed it to this when I tried it and it still does not work Do I > need to open the file first with fopen. > > $number ="1000001"; this number is not in the file > $data = file("d:\\www.twohot.com\\northwest\\data1.txt"); > > for($a=0;$a<count($data);$a++){ > if($number = $data[$a]){ ^ wrong operator. This is assignment. You need equality which is an == if ($number == $data[$a]){ > echo "The number has been found"; > $found = 1; > > } > } > > if(!$found){ > echo "The number was not found"; > } > > Sunday, September 10, 2000, 3:21:07 PM, you wrote: > > JAC> but $webfile = "data1.txt" just assigns the text value "data1.txt" > JAC> to the > JAC> variable $webfile. > JAC> you should first load the contents of data1.txt into $webfile. > > JAC> try using $webfile = file("data1.txt") /* This returns an array of lines of > JAC> data1.txt */ > > > >

« previous php.general (#16100) next »