I have a process in a PHP page that creates a file, and it works fine:
The name is based on a severity level data value and hospital name.
I now need to increment the filename since it is possible to need more than one file with the same severity level and hospital.
I see where autoincrementin g a database field is covered in PHP, but what about autoincrementin g a filename that is created by PHP?
TIA,
jej1216
Code:
if ("$_REQUEST[severity]" == "Level1-No_Obvious_Harm") {
$sevvar = "1";
} elseif ("$_REQUEST[severity]" == "Level2-Non-permanent_Harm") {
$sevvar = "2";
} elseif ("$_REQUEST[severity]" == "Level3-Semi-permanent_Harm") {
$sevvar = "3";
} elseif ("$_REQUEST[severity]" == "Level4-Major_Permanent_Harm") {
$sevvar = "4";
} elseif ("$_REQUEST[severity]" == "Level5-Death") {
$sevvar = "5";
} else {
$sevvar = "Nada";
}
$file = "notify/$sevvar".".$_REQUEST[fac_id]".".txt";
$handle = fopen($file, 'w');
fclose($handle);
I now need to increment the filename since it is possible to need more than one file with the same severity level and hospital.
I see where autoincrementin g a database field is covered in PHP, but what about autoincrementin g a filename that is created by PHP?
TIA,
jej1216
Comment