Hello Richard,

Thursday, January 1, 2004, 5:56:35 PM, you wrote:

RK> Ok I changed it to look this way but it still is not working
RK> $filenum="test";
RK> $fpHt = fopen($filenum, "r");
RK> while(feof($fpHt)) {
RK> $fpLine = fgets($fpHt,512);
RK> $fpLine = trim($fpLine);
RK> $fpData = explode(":", $fpLine);
RK> $fpData[0] = trim($fpData[0]);
RK> echo $fpData[0];
RK> }

>>>tester3:$1$09BZpdge$b7TQcsYSsAP1hgiCuCWtS1
>>>tester5:$1$5eq3i75D$XK9QzaS.7bHyWVf4bdyJs/

Save yourself some grief and use the file() function instead.

$filename = "test";
$fileData = file($filename);

for ($i = 0; $i < count($fileData); $i++)
{
    $output = substr($fileData[$i], 0, strpos($fileData[$i], ":"));
    echo $output;
}

strpos will work fine for this assuming the users don't have a : in
their username! Otherwise it'll return the first occurrence of it
within the string.

If it doesn't echo anything out, the file() function failed.

Warning: above not tested, just typed direct into this email. But
baring obvious syntax errors I might have typo'd, it should work.

-- 
Best regards,
 Richard                            mailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to