seularts Posted May 21, 2008 Share Posted May 21, 2008 this is my code so far: <?php $file = array_reverse( file( 'wr/events.php' ) ); foreach ( $file as $line ){ echo "$line\n"; } ?> I want to display a message if the page doesn't exist.. how do i do that by modifing my code!? Link to comment https://forums.phpfreaks.com/topic/106686-reading-from-file/ Share on other sites More sharing options...
p2grace Posted May 21, 2008 Share Posted May 21, 2008 Try this: <?php if(file_exists('wr/events.php')){ $file = array_reverse( file( 'wr/events.php' ) ); foreach ( $file as $line ){ echo "$line\n"; } }else{ echo "File doesn't exist"; } ?> Link to comment https://forums.phpfreaks.com/topic/106686-reading-from-file/#findComment-546944 Share on other sites More sharing options...
seularts Posted May 22, 2008 Author Share Posted May 22, 2008 Thanks.. i was so close as well:P Can you also give me an ideea how to display only 10 items per page with page counting!? If that is posible Link to comment https://forums.phpfreaks.com/topic/106686-reading-from-file/#findComment-547127 Share on other sites More sharing options...
seularts Posted May 22, 2008 Author Share Posted May 22, 2008 anyone!? Link to comment https://forums.phpfreaks.com/topic/106686-reading-from-file/#findComment-547255 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.