echo'ing a variable and cat'ing text

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

 



I have a file called userlist. I'm trying to read the file, and then echo their name and add @mdah.state.ms.us with it. In the file userlist, it looks like:

userabc
userdef
userxyz

and I have the following code:

<?php
$filename = "userlist";
$fp = fopen($filename, "r") or die ("Couldn't open $filename");
if ($fp)
{
while (!feof($fp))
       {
       $thedata = fgets($fp);
       if ($thedata != "")
               {
               echo "$thedata"."@mdah.state.ms.us";
               }
       }
fclose($fp);
}
?>


But when I run it, I get:

@mdah.state.ms.ususerabc
@mdah.state.ms.ususerdef
@mdah.state.ms.ususerxyz

and I am expecting to get:

userabc@xxxxxxxxxxxxxxxx
userdef@xxxxxxxxxxxxxxxx
userxyz@xxxxxxxxxxxxxxxx

So can someone look at my code and let me know why I'm not getting my expected output?

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


[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