SgtSakura
02-14-2005, 10:17 PM
Hi
i would like to know the code to Check if a file exists (a .txt file) and if it does exist ,include it
Could anyone please show me the code ?
Originally posted by SgtSakura
Hi
i would like to know the code to Check if a file exists (a .txt file) and if it does exist ,include it
Could anyone please show me the code ?
<?php
$filename = '/path/to/foo.txt';
if (file_exists($filename))
include ($filename);
?>
http://www.php.net/file_exists
SgtSakura
02-14-2005, 10:35 PM
Ok thanks
but how do i set that up when the .txt files name is a variable eg $comment
i have tryed replacing foo.txt with $comment but it didnt help
and i did update the path to file it does work but i need it to run using variable
SgtSakura
02-14-2005, 11:04 PM
Edit nevermind
i fixed it myself
no idea what i changed but it works now :)
Thanks for your help nuke