Forum Moderators: coopster & phranque

Message Too Old, No Replies

display if file size equals X

or don't show at all

         

idiotgirl

10:18 pm on Jan 27, 2002 (gmt 0)

10+ Year Member Top Contributors Of The Month



I have a drop list that displays different databases I can open for editing.

What I'd like to do - is if the database file is empty (data file exists but no data entries) show some default message like

<option>empty</option>

Can I do something like file size or content length or ?? to determine that there are no entries to spawn the "empty" message? Doesn't every file by nature have a default minimum file size?

Key_Master

10:45 pm on Jan 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's one way of doing it:

$file_size = (stat("/path_to/file_name.dat"))[7];

if ($file_size < 1) {
print "<option>empty</option>\n";
}

idiotgirl

3:05 pm on Jan 30, 2002 (gmt 0)

10+ Year Member Top Contributors Of The Month



key_master - thanks.