Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #8209

Re: classes in PHP

From "M. Strobel" <sorry_no_mail_here@nowhere.dee>
Newsgroups comp.lang.php
Subject Re: classes in PHP
Date 2013-02-03 19:39 +0100
Message-ID <an7p7gF2ktvU1@mid.uni-berlin.de> (permalink)
References <fd3565a9-3766-4224-bed5-812a0cd11d64@googlegroups.com> <c42bd135-6e8f-46e3-be37-445b423ff529@googlegroups.com>

Show all headers | View raw


Am 03.02.2013 18:49, schrieb Rita Ferreira:
> Hi,
> thanks for reply.
> The error I'm obtained is: 
> 
> Fatal error: Class 'config' not found in /Applications/MAMP/htdocs/admin_classes/UserController.php on line 10
> 
> UserController.php
> 
> <?php
> 
> error_reporting(E_ALL);
> ini_set('display_errors', '1');
> 
> class UserController
> {
> 	
> 	private $obj;
> 
> 	function __construct( ){}
> 
> 	public function login()
> 	{
> 		if($_SERVER["REQUEST_METHOD"] == "POST")
> 		{
> 			$obj=new config();
> 			$obj->conectar();
>                 }
>         (..)
>         }
> }
> 
> config.php
> 
> <?php
> 
> private $url_db;
> private $login_db;
> private $pass_db;
> private $db;
> 
> class config
> {
> 
> 	function __construct( )
>     { 
>         session_start();
>         $url_db="localhost";
>         $login_db="root";
>         $pass_db="root";
>         $db="colmeia";
>     }

Please put your answer below the text. You are in the "usenet", read about it, and
use a news reader if you can.

The message says it all: class config is unknown. You must use
include/include_once/require/require_once to pull the definitions in.

You would never start a session somewhere inside the code, session_start() is the
first thing to do.

/Str.

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

classes in PHP Rita Ferreira <ritaferreira83@gmail.com> - 2013-02-03 09:04 -0800
  Re: classes in PHP "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-02-03 18:11 +0100
  Re: classes in PHP Rita Ferreira <ritaferreira83@gmail.com> - 2013-02-03 09:49 -0800
    Re: classes in PHP "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-02-03 19:39 +0100
      Re: classes in PHP Jerry Stuckle <jstucklex@attglobal.net> - 2013-02-04 00:07 -0500
      Re: classes in PHP Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-06 13:29 +0100
        Re: classes in PHP Jerry Stuckle <jstucklex@attglobal.net> - 2013-02-06 08:49 -0500
        Re: classes in PHP "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-02-07 11:57 +0100
          Re: classes in PHP Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-07 12:17 +0100
          Re: classes in PHP Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-07 12:35 +0100
          Re: classes in PHP The Natural Philosopher <tnp@invalid.invalid> - 2013-02-07 11:46 +0000
            Re: classes in PHP "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-02-07 14:46 +0100
    Re: classes in PHP Simon <bad@example.com> - 2013-02-04 09:15 +0200

csiph-web