For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > June 2004 > PEAR::DB_DataObject Overload-ERRMSG









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author PEAR::DB_DataObject Overload-ERRMSG
Verona Busch

2004-06-24, 1:22 am

Hi,


i'm new to PEAR. You might can help me with this. :-)

My configuration:
W2K-Server
Apache/2.0.49 (Win32)
PHP/4.3.6 (CGI/not modulversion)
mySQL 3.23.49

PEAR::Packages

DB 1.6.1
DB_DataObject 1.6.1
DB_DataObject_FormBuilder 0.9.0
DB_NestedSet 1.3.4
DB_QueryTool 0.10.1
DB_Table 0.18

I did some tables with phpmyadmin and tried to create the classes with
DB::DataObject::createTable.php. Wonderful! Good Work!

But there seem to be some problems. Mayby cause of "Wi..." Sorry, of
"Not-Linux". The filename of the classes are all build with uppercase.
The require_once()-paths in all autogenerated table-classes is wrong. It
allways tells ('DB/DataObject.php). In my case that's wrong so i changed
it to require_once('PEAR/DB/DataObject.php').

Whenever I require more than one new table, i get following error message:

Cannot redeclare class db_dataobject_overload in
....Pear\DB\DataObject.php on line 183

The other thing is, that I don't know how to get a listed table just
like phpmyadmin does. Isn't there a tutorial how this PEAR::Packages
could be combined to get a nice output, input and changing Frontend in
HTML or XHTML?

Thanks
Justin Patrin

2004-06-24, 1:22 am

Verona Busch wrote:
> Hi,
>
>
> i'm new to PEAR. You might can help me with this. :-)
>
> My configuration:
> W2K-Server
> Apache/2.0.49 (Win32)
> PHP/4.3.6 (CGI/not modulversion)
> mySQL 3.23.49
>
> PEAR::Packages
>
> DB 1.6.1
> DB_DataObject 1.6.1
> DB_DataObject_FormBuilder 0.9.0
> DB_NestedSet 1.3.4
> DB_QueryTool 0.10.1
> DB_Table 0.18
>
> I did some tables with phpmyadmin and tried to create the classes with
> DB::DataObject::createTable.php. Wonderful! Good Work!
>
> But there seem to be some problems. Mayby cause of "Wi..." Sorry, of
> "Not-Linux". The filename of the classes are all build with uppercase.
> The require_once()-paths in all autogenerated table-classes is wrong. It
> allways tells ('DB/DataObject.php). In my case that's wrong so i changed
> it to require_once('PEAR/DB/DataObject.php').
>
> Whenever I require more than one new table, i get following error message:
>
> Cannot redeclare class db_dataobject_overload in
> ...Pear\DB\DataObject.php on line 183


Sounds like your require_once isn't working. Are you sure all of your
requires are using the same path? If you want PEAR stuff to work out of
the box, I highly recommend that you add the PEAR root to your
include_path in your php.ini. You're on "Not-Linux", so I'm pretty sure
you have access to that.

>
> The other thing is, that I don't know how to get a listed table just
> like phpmyadmin does. Isn't there a tutorial how this PEAR::Packages
> could be combined to get a nice output, input and changing Frontend in
> HTML or XHTML?


::grin:: You said the magic word, Frontend! I built a frontend package
for FormBuilder that's very PEAR friendly. You can get it here:

http://www.reversefold.com/PEAR/DB_DataObject_FormBuilder_Frontend/src/

Feel free to browse the source or download the tgz for easy using. If
you have any questions / comments, just ask. :-)

--
paperCrane <Justin Patrin>
Verona Busch

2004-06-24, 1:22 am

Justin Patrin wrote:
>
> Sounds like your require_once isn't working. Are you sure all of your
> requires are using the same path? If you want PEAR stuff to work out of
> the box, I highly recommend that you add the PEAR root to your
> include_path in your php.ini. You're on "Not-Linux", so I'm pretty sure
> you have access to that.
>


Yes and No. I change the include_path through ini_set() cause I can
change the php.ini here, but not at my provider. :-(

This seems to be not the main problem.

I took a look at php.net to find out how this include's and require's
work, but still have some questions on that.

I have a project folder in my htdocs dir.


htdocs
+
+--project
+ +
+ +-- DataObject //includes all for my PEAR::DB_DataObject
+ + ...
+ +
+ +
+ +-- php //includes my own php-files
+ + ...
+ +
+ +
+ +-- pear
+ + ...
+
+ index.php //my main testing file


In index.php I required all PEAR-Packages that I need

require_once('pear/DB.php');
require_once('pear/DB/DataObject.php');
require_once('pear/DB/DataObject/FormBuilder.php');
require_once('pear/DB/QueryTool.php');
require_once('pear/HTML/quickform.php');
require_once('pear/HTML/TreeMenu.php');

But in DataObject-Folder there are my generated table-classes which all
try to require like below. For example the file contacts.php:

require_once('DB/DataObject.php');


>
> ::grin:: You said the magic word, Frontend! I built a frontend package
> for FormBuilder that's very PEAR friendly. You can get it here:
>
> http://www.reversefold.com/PEAR/DB_DataObject_FormBuilder_Frontend/src/
>
> Feel free to browse the source or download the tgz for easy using. If
> you have any questions / comments, just ask. :-)
>



Thanks, but who actualy coded this? I find it on different threads and
you can download it on different sites as well? Is it yours?
Verona Busch

2004-06-24, 1:22 am

:-) Sorry, I got it running.

It's the same like path in Windows, isn't it?!

OK, anyway. I will try yours or whom ever Frontend.php and will come
back to you, if I can't figure it out, can I?
Justin Patrin

2004-06-24, 1:22 am

Verona Busch wrote:
> Justin Patrin wrote:
>
>
> Yes and No. I change the include_path through ini_set() cause I can
> change the php.ini here, but not at my provider. :-(
>
> This seems to be not the main problem.
>
> I took a look at php.net to find out how this include's and require's
> work, but still have some questions on that.
>
> I have a project folder in my htdocs dir.
>
>
> htdocs
> +
> +--project
> + +
> + +-- DataObject //includes all for my PEAR::DB_DataObject
> + + ...
> + +
> + +
> + +-- php //includes my own php-files
> + + ...
> + +
> + +
> + +-- pear
> + + ...
> +
> + index.php //my main testing file
>
>
> In index.php I required all PEAR-Packages that I need
>
> require_once('pear/DB.php');
> require_once('pear/DB/DataObject.php');
> require_once('pear/DB/DataObject/FormBuilder.php');
> require_once('pear/DB/QueryTool.php');
> require_once('pear/HTML/quickform.php');
> require_once('pear/HTML/TreeMenu.php');
>
> But in DataObject-Folder there are my generated table-classes which all
> try to require like below. For example the file contacts.php:
>
> require_once('DB/DataObject.php');
>
>
>
>
> Thanks, but who actualy coded this? I find it on different threads and
> you can download it on different sites as well? Is it yours?


*I* wrote this. If you're seeing the code on something other than
reversefold.com, I'd like to know as I haven't put it anywhere else (of
course, anyone's free to use it, etc...). I have posted about it in
other threads and have used a few other URLs, including a PEPR proposal,
which is now deleted.

Why do you question that I wrote it?

--
paperCrane <Justin Patrin>
Alan Knowles

2004-06-24, 1:22 am


>
> In index.php I required all PEAR-Packages that I need
>
> require_once('pear/DB.php');
> require_once('pear/DB/DataObject.php');
> require_once('pear/DB/DataObject/FormBuilder.php');
> require_once('pear/DB/QueryTool.php');
> require_once('pear/HTML/quickform.php');
> require_once('pear/HTML/TreeMenu.php');


It's far better to do:
ini_set('include_path', dirname(__FILE__).PATH_SEPERATOR.
dirname(__FILE__).'/pear'.PATH_SEPERATOR
);

** this ensures that
a) pear's paths work
b) you only make available the pear packages versions that you know work
c) changes to the installed system's pear code will not affect you..

then
require_once('DB.php');
require_once('DB/DataObject.php');
require_once('DB/DataObject/FormBuilder.php');
require_once('DB/QueryTool.php');
require_once('HTML/quickform.php');
require_once('HTML/TreeMenu.php');

you cant mess around with the paths for pear - all the packages depend
internally on the fact that it works like this.


Regards
Alan
Verona Busch

2004-06-24, 3:55 pm

Alan Knowles wrote:

>
>
>
> It's far better to do:
> ini_set('include_path', dirname(__FILE__).PATH_SEPERATOR.
> dirname(__FILE__).'/pear'.PATH_SEPERATOR
> );
>


Sorry, but I don't understand this syntax. Could you fill it with real
names, please?

What I did now, is following:

ini_get("include_path") . ".;z:\htdocs\project\test\pear" );

my standard pear installation is in "z:\htdocs\pear", but I need to put
it directly into the project-folders, here it is "test".


> ** this ensures that
> a) pear's paths work
> b) you only make available the pear packages versions that you know work
> c) changes to the installed system's pear code will not affect you..


I didn't get b). Could you explain?

>
> then
> require_once('DB.php');
> require_once('DB/DataObject.php');
> require_once('DB/DataObject/FormBuilder.php');
> require_once('DB/QueryTool.php');
> require_once('HTML/quickform.php');
> require_once('HTML/TreeMenu.php');
>


I did this.

> you cant mess around with the paths for pear - all the packages depend
> internally on the fact that it works like this.
>


Yes, that's what I finaly find out through this threat. :-) Lucky, I am!
>
> Regards
> Alan


Thanks Alan
Verona Busch

2004-06-24, 3:55 pm

Justin Patrin wrote:
>
> *I* wrote this. If you're seeing the code on something other than
> reversefold.com, I'd like to know as I haven't put it anywhere else (of
> course, anyone's free to use it, etc...). I have posted about it in
> other threads and have used a few other URLs, including a PEPR proposal,
> which is now deleted.
>
> Why do you question that I wrote it?
>


I followed an older thread and thought it was from markus. That's why I
asked. My fault. Sorry! But I'm sure I've seen it at an other URL some
time ago. Sure, that there is only yours left?

Vero
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com