[thelist] PHP & Last Entry in Flat File DB was: (no subject)

Steve Lewis slewis at macrovista.net
Tue May 7 17:01:24 CDT 2002

Robin Hastings wrote:

>Hello! I'm sure that this is a simple thing to do, but I am incapable
>of figuring out how to do it using the online manual at php.net. I have
>a text file (flatfile database, basically) with records as follows:
>entry#, place, date, time \n
>I need to find the last entry number in the file. If I could do this
>with a regular database, I would, but it is possible that the hosting
>on this site will be php-enabled, but no database - that is out of my
>hands. Can anyone give me a clue as to how to find the first field of
>the last record in a text file? Thanks in advance,
>Robin Hastings
>robin at rhastings.net
I would recommend you read the file into a string and use the split()
function to split the string contents into an array (such as
$entryArray) based on newlines, then you can extract the last element
using end() and then split that into another array (such as
$lastEntryArray) based on commas, and then $lastEntryNumber =


More information about the thelist mailing list