...

View Full Version : please: need help with "excelwriter.class.php"



MalcolmW
01-23-2012, 06:49 PM
Please:

(1) I'm trying to use some PHP code that I've copied from the internet that is a "black box" to me.

(2) The code gets good reviews from people who have used it successfully. But I don't understand PHP well enough to know why it won't work for me.

(3) Could anyone help, please?

(4) I'm trying to use it in an HTML page to write MYSQL table data to an Excel file using PHP.

(5) The part that is apparently failing for me is this:

include_once("excelwriter.class.php");

(6) I get this kind of error:

Warning: include_once(excelwriter.class.php) [function.include-once]: failed to open stream: No such file or directory in D:\xxxxx on line 148

(7) Could someone step me through what's necessary to resolve this?

(8) Apparently I need to create a class of some kind in some directory on my webserver -- and I have no clue how to do that.

(9) I'm entirely unfamiliar with "classes" and so need real "php for dummies" kind of help to do this --step by step . . .

Thanks, Malcolm.

BluePanther
01-23-2012, 07:24 PM
include_once() (or any other include/require function) will look for the specified file in it's parameter. So, include_once("excelwriter.class.php") will look for the file excelwriter.class.php in the same directory as the script running the include. You can specify either a relative or explicit path to direct the include to your file.

Your error message, specifically, means it can't find that file.

MalcolmW
01-23-2012, 09:10 PM
include_once() (or any other include/require function) will look for the specified file in it's parameter. So, include_once("excelwriter.class.php") will look for the file excelwriter.class.php in the same directory as the script running the include. You can specify either a relative or explicit path to direct the include to your file.

Your error message, specifically, means it can't find that file.

(1) I apreciate your help.

(2) I added a blank "excelwriter.class.php" file to the directory -- as you recommended.

(3) Looking more closely at the code . . . I'm actually trying to execute a "require" rather than an "include" of that file (sorry):

====> require_once("excelwriter.class.php");

(4) I'm now getting this error:

====> Fatal error: Class 'ExcelWriter' not found in D:\Hosting\xxx.php on line 15

(5) And this is what I am fundamentally confused about.

(6) Do I only need a file in the directory . . . or does the file TYPE also need to be defined in some way somewhere?

(7) The place where I copied this code from had the following comment about it:

"Include phpexcel class file along with your config file and make its object with excel file name passed parameter in constructor"

(8) But I couldn't figure out what that means . . .

Thanks again, Malcolm.

BluePanther
01-23-2012, 09:54 PM
(1) I apreciate your help.

(2) I added a blank "excelwriter.class.php" file to the directory -- as you recommended.

(3) Looking more closely at the code . . . I'm actually trying to execute a "require" rather than an "include" of that file (sorry):

====> require_once("excelwriter.class.php");

(4) I'm now getting this error:

====> Fatal error: Class 'ExcelWriter' not found in D:\Hosting\xxx.php on line 15

(5) And this is what I am fundamentally confused about.

(6) Do I only need a file in the directory . . . or does the file TYPE also need to be defined in some way somewhere?

(7) The place where I copied this code from had the following comment about it:

"Include phpexcel class file along with your config file and make its object with excel file name passed parameter in constructor"

(8) But I couldn't figure out what that means . . .

Thanks again, Malcolm.

I didn't recommend that at all. I said you need to direct your include (or require) to the valid file. The error you're getting means that the definition for ExcelWriter couldn't be found - I'm guessing it's in the REAL excelwriter.class.php. PHP, like any other language, isn't psychic - everything needs to be defined.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum