FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » classes in PHP
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: classes in PHP [message #180292 is a reply to message #180275] Mon, 04 February 2013 05:07 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 2/3/2013 1:39 PM, M. Strobel wrote:
> 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.
>

Almost... If you have a class object in the session, you need to include
or require the class object first.

Generally, in require_once() the necessary class code, *then* call
session_start().


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: change a string where have number after a word
Next Topic: Problem with readdir and ssh2
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 29 19:25:10 GMT 2024

Total time taken to generate the page: 0.04696 seconds