I have a page whr pictures r been displayed from the directory..
So when imgs r dr in directory it gets displayed in a page thru php code... Problem is whn dr s no image in dat directory den i get long error.. it irritates..
Wrap the code in an if block that tests the directory name before trying to scan it:
PHP Code:
$dirname = "directory-name/";
// use "@" to suppress warnings from is_dir() and is_readable():
if(@is_dir($dirname) && @is_readable($dirname)) {
// do your stuff here
}
PS: I'd suggest using proper English here instd of da chat shorthand, both to look more professional and to help those here for whom English is not their first language.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Thanks a lot .. Need a favour from you.. please help..
Using same above Code
- Can we display the image name below each n every imgs?
- Is thr any way to display no of files in directory..?
- Using above codes shws da images when there are files in directory n if not den nthn gets displayed dats fine.. but is it possible that when thr is no image to show some msg ? (onli when dr s no images in dat directory)
Bookmarks