Forum Moderators: coopster

Message Too Old, No Replies

php fread file

         

music_man

10:22 pm on Jan 7, 2006 (gmt 0)

10+ Year Member



Hi

I have looked up the php manual but I am not sure how to do this:

say I have a text file called "test.txt" and there are these rows:

test@test.com¦¦g98hsdgkjdfhgi
test2@test2.com¦¦skguhsdgiu897rg

I could like to be able to have it so that all before the double pipes are $email and all after the pipe are $id.

Any ideas?

Thanks

inveni0

10:28 pm on Jan 7, 2006 (gmt 0)

10+ Year Member



mySQL? That's what I'd use.

jc_armor

2:03 pm on Jan 8, 2006 (gmt 0)

10+ Year Member



try this one:

$fp = fopen("test.txt","r");
$val = fread($fp,filesize("test.txt");
fclose($fp);

$arrValues = explode("¦¦",$val);
print_r($arrValues);

hope this helps