I'm having big problems with this fatal error. I have 5 files and every of them contains one class (Nationality.php, Team.php, BoughtTickets.php, Users.php, Tickets.php) and two of them require other classes.
So here is index.php
<?php
require 'header.html';
require 'pages/first.html';
require 'class/db.php';
$c=DB::connect();
require 'pages/footer.html';
?>
Users.php
require 'Nationality.php';
require 'Team.php';
require 'BoughtTickets.php';
class Users{
public $Email;
public $Name;
...
BoughtTickets.php
require 'Tickets.php';
class BoughtTicket{
public $IDTicket;
public $Date;
...
Eveytime I want to login, it gives me fatal error. If I remove line require 'BoughtTickets.php'; from class Users, it works, but it won't display table in one file which requires class BoughtTickets.php. Do you have any idea what to do to solve the problem?
Thank you
require_once('....')is your friend. Also,if(!class_exists('BoughtTicket')): require('BoughtTickets.php'); endif;is sufficient as well. - Ohgodwhyits not workinglacks sufficient information to attempt to answer this question. What is occuring when usingrequire_once()orif(!class_exists('...'))- Ohgodwhyrequire_once()statements aren't working right. Better yet, why not just look into usingnamespacing? - Ohgodwhyrequire_once()actually solved a problem in the end. Thanks :) - xKRgirl01