Searching a test file...

From: Date: Tue, 15 Jul 2003 06:08:25 +0000
Subject: Searching a test file...
Groups: php.general 
Request: Send a blank email to php-general+get-155227@lists.php.net to get a copy of this message
Hi people, back again... Got some help this today (tnx Curt) from the list but for another chunk of the code I'm doing... Now, I can't seem to get the following code to work... Have included some sample lines from the datafile (acc.txt) No matter what I do, it always returns "not here" even if there is a match....very frustrating! Any ideas? Lloyd. :-) ---- Code Begin ----- <?php $name_to_write = "user1"; $names = file("acc.txt"); if (in_array($name_to_write, $names)) { echo "hello"; } else { echo "not here"; } ?> ---- Code Finish ---- --- Sample Data Begin ---
user1           26:48:59     6 logins   4:28:09 hrs/login
user2           19:07:50   33 logins   0:34:46 hrs/login
user3           12:12:04   18 logins   0:40:40 hrs/login
--- Sample Data End ---

« previous php.general (#155227) next »