try catch error


Posted on 16th Feb 2014 07:03 pm by admin

I have been trying try catch but, I can't get it to work. The code opens a non existing file called "a"

Code: private function fileOpenMethod($filePath, $numberOfLines,$header,$replaceHeader){
try{
Did you know?Explore Trending and Topic pages for more stories like this.
$file = file( $filePath);
}catch(file $e){
$e= "the flie path does not work"; //. $e->getMessage();
}

return $e;
}
I am getting an error message on the page but not the one that am trying to generate
Code: Warning: file(a) [function.file]: failed to open stream: No such file or directory in /home/public_html/_Doc/StripFileClass.php on line 15

I am sure it is simple but I am new to try and catch and it is a learning curve blah blah blah.
Can anyone see what I am doing wrong =)
No comments posted yet

Your Answer:

Login to answer
320 Like 17 Dislike
Previous forums Next forums
Other forums

Remove values in array2 from array1
I have two arrays.

Array 1 is where the array key holds various different numbers. For exampl

upload only text files
hi guys i want to upload only text like like (pdf,note pad and ofiice files) so can any one please t

update 2 columns by doing inner 2-column query
Hi,
is something like this possible?

update contract_all set col1,col2 =
(

image upload, resize THEN submit form
Ok so I have a form that requires the user to upload an image, and then do something with that image

MYSQL gen help
This is my Mysql gen. can anyone tell me why this echos

MID(networkset.networkid, 3, 3) AS &q

Syntax error
hi im having a little trobble with this script
-------------------------------------------------

need help with this contact form
I made this form and I need it to read the data and write the data to a table and its not working ca

Undefined Variable: PHP_SELF, pls help
Hi,

Im a newbie on PHP / MySQL programming and Im running a script to search one field on my

calendar dates and hours compare problem
i have a calendar in wordpress, everything works great except that i can make 2 meetings at the same

php mysql script to find record
Hi,

Currently I have a simple table with 4 columns. A, B, C, D

If I want to find all

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash