Hi this is my first post so please bare with me, im currently learning php and im currently stuck with the code I have below.
what it does
It reads the 'first full line' of the flat file database.
This is the code I have that works as I described above:
<?php
$myFile = "members.php";
$fh = fopen($myFile, 'r');
$theData = fgets($fh);
fclose($fh);
echo $theData;
?>
what i need it to do
I need it to read the 'last line' and only the 'first word' of the last line from the flat file database. I need it so the output is creativep
This is the syntax of the flat file:
creativep|65457487454564548754gh454|me@email.com|dave creativep
*username|password|email|full name
*the flat file writes backwards, so the newest line is the bottom line
Hope ive explained myself correctly, any help would be appreciated.
Kind regards,
Dave