RE: [PHP] problem with require_once

2007-08-15 Thread Sanjeev N
Hi,

The problem is simple...
Either the file myclass.php path is wrong (may be your calling file is in
some folder and myclass.php is in another folder) or if path is correct and
file may have some syntax errors or some function may not exist..

Please check the path if wrong and check the file for syntax and content if
path is correct

Warm Regards,
Sanjeev
http://www.sanchanworld.com/
http://webdirectory.sanchanworld.com - Submit your website URL
http://webhosting.sanchanworld.com - Choose your best web hosting plan
-Original Message-
From: Vanessa Vega [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 15, 2007 11:30 AM
To: php-general@lists.php.net
Subject: [PHP] problem with require_once

Good day to all...

I would like to ask for some help..
I have a form created in javascript codes. The page is a pop up window.
I am passing the values of the form using the method "post". The PHP file 
that handles the form displays the values from that and  had the following 
code in the beginning:



when i clicked the submit button, nothing happens and the page wouldl just 
refresh...
but when i removed the require_once code of my PHP, the values from the form

is displayed but of course, will not be saved since the class isnt 
there.

can anyone help me 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] problem with require_once

2007-08-14 Thread Chris

Vanessa Vega wrote:

Good day to all...

I would like to ask for some help..
I have a form created in javascript codes. The page is a pop up window.
I am passing the values of the form using the method "post". The PHP file 
that handles the form displays the values from that and  had the following 
code in the beginning:


rest of the code for displaying and saving  values to an 
existing databse--


?>

when i clicked the submit button, nothing happens and the page wouldl just 
refresh...
but when i removed the require_once code of my PHP, the values from the form 
is displayed but of course, will not be saved since the class isnt 
there.


The file 'myclass.php' isn't in the same folder as your new script so 
php can't find it.


Using 'require' tells php to die if it can't find the file - which is 
what is happening.


--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] problem with require_once

2007-08-14 Thread Tijnema
On 8/15/07, Vanessa Vega <[EMAIL PROTECTED]> wrote:
> Good day to all...
>
> I would like to ask for some help..
> I have a form created in javascript codes. The page is a pop up window.
> I am passing the values of the form using the method "post". The PHP file
> that handles the form displays the values from that and  had the following
> code in the beginning:
>
> 
>require_once('myclass.php');
>
>//this class contains all functions for me to connect on the database
>
> rest of the code for displaying and saving  values to an
> existing databse--
>
> ?>
>
> when i clicked the submit button, nothing happens and the page wouldl just
> refresh...
> but when i removed the require_once code of my PHP, the values from the form
> is displayed but of course, will not be saved since the class isnt
> there.
>
> can anyone help me
>

Well, then you're problem is probably in your myclass.php file...
Please show some relevant code so that we can help.

Tijnema

-- 
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] problem with require_once

2007-08-14 Thread Vanessa Vega
Good day to all...

I would like to ask for some help..
I have a form created in javascript codes. The page is a pop up window.
I am passing the values of the form using the method "post". The PHP file 
that handles the form displays the values from that and  had the following 
code in the beginning:



when i clicked the submit button, nothing happens and the page wouldl just 
refresh...
but when i removed the require_once code of my PHP, the values from the form 
is displayed but of course, will not be saved since the class isnt 
there.

can anyone help me 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem with require_once

2006-04-07 Thread chris smith
On 4/8/06, Pablo L. de Miranda <[EMAIL PROTECTED]> wrote:
> I has modified my code to this, notice wich all directories that I
> refer is in the root of application:
>
> // File Controller.php in directory controller:
> $file = '../util/ClassUtil.php';
> echo $file.'';
> include $file;
> $service = ClassUtil::loadClass('service.FormularioService');
> $service->helloWorld();
>
> // File ClassUtil.php in diretory util:
> class ClassUtil {
>
> function __construct() {
> echo 'Construindo objecto';
> }
>
> static public function loadClass($class) {
> $str = explode('.',$class) ;
> $className = $str[count($str) - 1];
>
> $obj = null;
>
> $exist = false;
> $scriptName = $_SERVER['SCRIPT_NAME'];
> $paths = explode('/', $scriptName);
> $url = 'http://'.$_SERVER['HTTP_HOST'];
> $appDir = $_SERVER['DOCUMENT_ROOT'];
>
> $class = str_replace(".", "/", $class);
> $path = "";
> for ($i = 0; $i < count($paths) - 1; $i ++) {
> $path .= '/'.$paths[$i];
> echo 'AppDir: '.$appDir.$path.'';
>
> $c = $appDir.$path.'/'.$class.'.php';
>
> while (strstr($c, '//'))
> $c = str_replace('//', '/', $c);
>
> echo 'Carregando classe: '.$c.'';
> if (file_exists($c)) {
> echo 'Carregando a URL: 
> '.$url.$path.'/'.$class.'.php';
> include $url.$path.'/'.$class.'.php';
> $exist = true;
> return new $className;
> }
>
> }
> if (!$exist)
> echo 'ERRO: O ARQUIVO NAO EXISTE!...';
> }
> }
>
> // File FormularioService.php in directory service:
> class FormularioService {
>
> public function helloWorld() {
> echo 'Hello World.';
> }
> }
> $serv = new FormularioService;
> $serv->helloWorld();
>
> And my output in the browser is that:
> ../util/ClassUtil.php
>
> argv: Array
> argc: 1
> AppDir: /var/www//
> Carregando classe: /var/www/service/FormularioService.php
>
> AppDir: /var/www///egressos
> Carregando classe: /var/www/egressos/service/FormularioService.php
> Carregando a URL: http://localhost//egressos/service/FormularioService.php
> Hello World.
>
> Fatal error: Class 'FormularioService' not found in
> /home/pldm/projetos/egressos/src/util/ClassUtil.php on line 44

What's in this file?

/var/www/egressos/service/FormularioService.php


(Always CC the list).

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem with require_once

2006-04-07 Thread chris smith
On 4/8/06, Pablo L. de Miranda <[EMAIL PROTECTED]> wrote:
> Hey Guys,
> I have the code below:
>
> $file = $_SERVER['HTTP_REFERER'].'util/ClassUtil.php';
> echo $file.'';
> require_once($file);
>
> $service = ClassUtil::loadClass('service.FormularioService');
>
> And the output in browser:
>
> http://localhost/egressos/util/ClassUtil.php
>
> Fatal error: Class 'ClassUtil' not found in
> /home/pldm/projetos/egressos/src/controller/Controller.php on line 27

This is a different file - is it included by
$_SERVER['HTTP_REFERER'].'util/ClassUtil.php' ?

PS - Relyig on the referrer for something like this is extremely dangerous.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem with require_once

2006-04-07 Thread Anthony Ettinger
can you do a dump of what $file is?

Seems the path is incorrect.

On 4/7/06, Pablo L. de Miranda <[EMAIL PROTECTED]> wrote:
>
> Hey Guys,
> I have the code below:
>
> $file = $_SERVER['HTTP_REFERER'].'util/ClassUtil.php';
> echo $file.'';
> require_once($file);
>
> $service = ClassUtil::loadClass('service.FormularioService');
>
> And the output in browser:
>
> http://localhost/egressos/util/ClassUtil.php
>
> Fatal error: Class 'ClassUtil' not found in
> /home/pldm/projetos/egressos/src/controller/Controller.php on line 27
>
> But, the file that I pass to require_once exist in the server...
> If someone know the problem, please sende a answer...
>
> Thank you,
>
> Pablo
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html


[PHP] Problem with require_once

2006-04-07 Thread Pablo L. de Miranda
Hey Guys,
I have the code below:

$file = $_SERVER['HTTP_REFERER'].'util/ClassUtil.php';
echo $file.'';
require_once($file);

$service = ClassUtil::loadClass('service.FormularioService');

And the output in browser:

http://localhost/egressos/util/ClassUtil.php

Fatal error: Class 'ClassUtil' not found in
/home/pldm/projetos/egressos/src/controller/Controller.php on line 27

But, the file that I pass to require_once exist in the server...
If someone know the problem, please sende a answer...

Thank you,

Pablo

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php