Error has been fixed

Thanks for everyone’s help

The website uses: Bootstrap, sccs and js

The HTML code (index file) is incomplete and stops abruptly - try uploading again

and always check the source afterwards



Another possible reason is that your HTML file exceeds the limit ( > 1MB), so only the code that was present before remains

8 Likes

Hey, on my filezilla it just shows the entire file including that what is supposed to be under there I reuploaded it again same issue also the PHP files are not over 1 MB nor is any other css or js file also on https://filemanager.ai/ it shows the files correctly

Are these Chemistry Grades tables supposed to be generated with PHP code? If so, your PHP code may be crashing. That can cause the page to abruptly stop rendering.

To start fixing this, please try enabling display_errors and refresh the page and see if that produces an error message:

6 Likes

I used the chemistry page as example every single page has the same issue where it doesnt show up as supposed I added the "“ini_set(‘display_errors’, 1);
ini_set(‘display_startup_errors’, 1);
error_reporting(1);” and still no change

  1. please copy the source code from your local file and paste here on the forum

  2. then select all code and choose code formatting (click) from the menu

image

  1. publish post
4 Likes

Are you aware that this code is DISABLING and hiding all error messages? And that even if you enable display_errors through .htaccess, this code will take precedence and block any error messages from being shown?

It’s very likely that your code is crashing, so please make sure to enable display_errors. There is an error in your website, and you can’t fix an error by simply hiding all evidence.

7 Likes

Yes I know It has to be 1 instead of 0 but still no results underneath is the code for localhost which is excactly the same as the one i uploaded on here it doesnt show any errors on here

 <?php
session_start();

// Assuming you have a way to check if the user is logged in
$isLoggedIn = isset($_SESSION['user_id']);
// Database connection parameters
$host = 'localhost'; // Change this if your database is hosted elsewhere
$dbname = 'supr';
$username = 'root';
$password = '';


// Create a database connection
try {
    $conn = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
    // Set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    // Query to fetch amount of points and required amount of points from the database
    $stmt = $conn->query("SELECT amount_of_points, minimum_points FROM average");
    $row = $stmt->fetch(PDO::FETCH_ASSOC);
    $amount_of_points = $row['amount_of_points'];
    $required_amount_of_points = $row['minimum_points'];
    // Query to fetch average grades
    $stmt = $conn->query("SELECT average_grade, required_average_grade FROM average_grades");
    $row = $stmt->fetch(PDO::FETCH_ASSOC);
    $average_grade = $row['average_grade'];
    $required_average_grade = $row['required_average_grade'];
} catch(PDOException $e) {
    echo "Connection failed: " . $e->getMessage();
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title>SUPR - Melle Koot</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <meta content="SUPR - Melle Koot" name="keywords">
    <meta content="SUPR - Melle Koot" name="description">

    <!-- Favicon -->
    <link href="img/favicon.ico" rel="icon">

    <!-- Google Web Fonts -->
    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet"> 

    <!-- Font Awesome -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0/css/all.min.css" rel="stylesheet">

    <!-- Libraries Stylesheet -->
    <link href="lib/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet">

    <!-- Customized Bootstrap Stylesheet -->
    <link href="css/style.css" rel="stylesheet">
    <style>
    /* Styles for the Excel-like table */
    .excel-table {
        font-family: Arial, sans-serif;
        border-collapse: collapse;
        width: 100%;
        box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
        border-radius: 5px;
        overflow-x: auto; /* Horizontal scrolling */
        -webkit-overflow-scrolling: touch; /* Enables smooth scrolling on iOS */
    }

    .excel-table h2 {
        text-align: center;
        margin-top: 20px;
        margin-bottom: 10px;
    }

    .excel-table h3 {
        text-align: center;
        margin-bottom: 20px;
    }

    .excel-table th, .excel-table td {
        padding: 12px 15px;
        text-align: center;
    }

    .excel-table .header {
        background-color: #f2f2f2;
        color: #333;
        font-weight: bold;
    }

    .excel-table .subject {
        background-color: #f9f9f9;
    }

    .excel-table .mark:nth-child(odd) {
        background-color: #f2f2f2;
    }

    .excel-table .average {
        background-color: #dff0d8;
        font-weight: bold;
    }

    .excel-table tr:last-child {
        border-bottom: 2px solid #333;
    }

    .excel-table tr:hover {
        background-color: #e9e9e9;
    }

    /* Media query for small screens */
    @media screen and (max-width: 768px) {
        .excel-table {
            overflow-x: scroll; /* Horizontal scrolling for small screens */
            -webkit-overflow-scrolling: touch; /* Enables smooth scrolling on iOS */
            white-space: nowrap; /* Prevents table cells from wrapping */
        }
    }
</style>

</head>

<body>
    <!-- Topbar Start -->
    <div class="container-fluid d-none d-lg-block">
        <div class="row align-items-center py-4 px-xl-5">
            <div class="col-lg-3">
                <a href="https://supr.melle-koot.com" class="text-decoration-none">
                    <h1 class="m-0"><span class="text-primary">Project</span> SUPR</h1>
                </a>
            </div>
          
            <div class="col-lg-3 text-right">
                <div class="d-inline-flex align-items-center">
                     <i class="fa fa-2x fa-graduation-cap text-primary mr-3"></i>
                    <div class="text-left">
    <h6 class="font-weight-semi-bold mb-1">Average Grade</h6>
    <small>Average grade: <?php echo $average_grade; ?> Required grade: <?php echo $required_average_grade; ?>.</small>
    
</div>

                </div>
            </div>
            <div class="col-lg-3 text-right">
                <div class="d-inline-flex align-items-center">
                       <i class="fa fa-2x fa-dot-circle text-primary mr-3"></i>
                    <div class="text-left">
                        <h6 class="font-weight-semi-bold mb-1">Amount of points</h6>
                        <small>Amount of points: <?php echo $amount_of_points; ?> Required amount of points: <?php echo $required_amount_of_points; ?>.</small>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- Topbar End -->


    <!-- Navbar Start -->
    <div class="container-fluid">
        <div class="row border-top px-xl-5">
            <div class="col-lg-3 d-none d-lg-block">
                <a class="d-flex align-items-center justify-content-between bg-secondary w-100 text-decoration-none" data-toggle="collapse" href="#navbar-vertical" style="height: 67px; padding: 0 30px;">
                    <h5 class="text-primary m-0"><i class="fa fa-book-open mr-2"></i>Subjects</h5>
                    <i class="fa fa-angle-down text-primary"></i>
                </a>
                <nav class="collapse position-absolute navbar navbar-vertical navbar-light align-items-start p-0 border border-top-0 border-bottom-0 bg-light" id="navbar-vertical" style="width: calc(100% - 30px); z-index: 9;">
                    <div class="navbar-nav w-100">
                        <a href="https://supr.melle-koot.com/mathematics" class="nav-item nav-link">Mathematics</a>
                        <a href="https://supr.melle-koot.com/dutch" class="nav-item nav-link">Dutch</a>
                        <a href="https://supr.melle-koot.com/english" class="nav-item nav-link">English</a>
                        <a href="https://supr.melle-koot.com/german" class="nav-item nav-link">German</a>
                        <a href="https://supr.melle-koot.com/history" class="nav-item nav-link">History</a>
                        <a href="https://supr.melle-koot.com/global-challenges" class="nav-item nav-link">Global Challenges</a>
                        <a href="https://supr.melle-koot.com/physics" class="nav-item nav-link">Physics</a>
                        <a href="https://supr.melle-koot.com/chemistry" class="nav-item nav-link active">Chemistry</a>
                        <a href="https://supr.melle-koot.com/music" class="nav-item nav-link">Music</a>
                        <a href="https://supr.melle-koot.com/spanish" class="nav-item nav-link">Spanish</a>
                    </div>
                </nav>
            </div>
            <div class="col-lg-9">
                <nav class="navbar navbar-expand-lg bg-light navbar-light py-3 py-lg-0 px-0">
                    <a href="" class="text-decoration-none d-block d-lg-none">
                        <h1 class="m-0"><span class="text-primary">Project </span>SUPR</h1>
                    </a>
                    <button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbarCollapse">
                        <span class="navbar-toggler-icon"></span>
                    </button>
                    <div class="collapse navbar-collapse justify-content-between" id="navbarCollapse">
                        <div class="navbar-nav py-0">
                            <a href="https://supr.melle-koot.com/" class="nav-item nav-link ">Home</a>
                            <a href="https://supr.melle-koot.com/about" class="nav-item nav-link">About</a>
                            <a href="https://supr.melle-koot.com/subjects" class="nav-item nav-link">Subjects</a>
                            <a href="https://supr.melle-koot.com/grades" class="nav-item nav-link active">Grades</a>
                            <div class="nav-item dropdown">
                                <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">Blog</a>
                                <div class="dropdown-menu rounded-0 m-0">
                                  <a href="https://supr.melle-koot.com/blog" class="dropdown-item">Blog List</a>
                                </div>
                            </div>
                            <a href="https://supr.melle-koot.com/contact" class="nav-item nav-link">Contact</a>
                        </div>
                           <?php if ($isLoggedIn): ?>
        <p>Logged In as Admin</p>
    <?php else: ?>
        <a class="btn btn-primary py-2 px-4 ml-auto d-none d-lg-block" href="https://supr.melle-koot.com/login">Admin Login</a>
    <?php endif; ?>
                    </div>
                </nav>
            </div>
        </div>
    </div>
    <!-- Navbar End -->
    <!-- Header Start -->
    <div class="container-fluid page-header" style="margin-bottom: 90px;">
        <div class="container">
            <div class="d-flex flex-column justify-content-center" style="min-height: 300px">
                <h3 class="display-4 text-white text-uppercase">Chemistry Grades</h3>
                <div class="d-inline-flex text-white">
                    <p class="m-0 text-uppercase"><a class="text-white" href="https://supr.melle-koot.com">Home</a></p>
                    <i class="fa fa-angle-double-right pt-1 px-3"></i>
                    <p class="m-0 text-uppercase">Chemistry grades</p>
                </div>
            </div>
        </div>
    </div>
    <!-- Header End -->


    <!-- Team Start -->
    <div class="container-fluid py-5">
        <div class="container pt-5 pb-3">
            <div class="text-center mb-5">
                <h5 class="text-primary text-uppercase mb-3" style="letter-spacing: 5px;">Chemistry Grades</h5>
                <h1>Check out my Chemistry grades</h1>
            </div>
          
     
            <?php

$servername = "localhost";
$username = "root";
$password = "";
$dbname = "supr";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Fetch all distinct subjects (filtering for Chemistry)
$sqlDistinctSubjects = "SELECT DISTINCT subject FROM grades WHERE subject = 'Chemistry' ORDER BY subject";
$resultDistinctSubjects = $conn->query($sqlDistinctSubjects);

// Fetch the average mark for Chemistry
$sqlAverageMathMark = "SELECT AVG(mark) as average_mark FROM grades WHERE subject = 'Chemistry'";
$resultAverageMathMark = $conn->query($sqlAverageMathMark);
$rowAverageMathMark = $resultAverageMathMark->fetch_assoc();

echo '<div class="excel-table">';
echo '<h2 class="table-title">Chemistry Grades</h2>';
echo '<hr>';

// Display the average mark for Chemistry
echo '<h3 class="average-mark">Average Grade for Chemistry: ' . number_format($rowAverageMathMark['average_mark'], 2) . '</h3>';
echo '<hr>';

// Display a styled table with all marks for Chemistry
echo '<div class="table-container">';
echo '<table class="table">';

// Table headers
echo '<tr>';
echo '<th class="header">Subject</th>';
echo '<th class="header">Average</th>';

for ($i = 1; $i <= 5; $i++) {
    echo '<th class="header">Mark ' . $i . '</th>';
}

echo '</tr>';
while ($rowSubject = $resultDistinctSubjects->fetch_assoc()) {
    $subject = $rowSubject['subject'];

    // Fetch marks for Chemistry (oldest first)
    $sqlMarksForMath = "SELECT mark FROM grades WHERE subject = 'Chemistry' ORDER BY date ASC LIMIT 5";
    $resultMarksForMath = $conn->query($sqlMarksForMath);

    // Calculate the average mark for Chemistry
    $sqlAverageForMath = "SELECT AVG(mark) as average_mark FROM grades WHERE subject = 'Chemistry'";
    $resultAverageForMath = $conn->query($sqlAverageForMath);
    $rowAverageForMath = $resultAverageForMath->fetch_assoc();

    echo '<tr>';
    echo '<td class="subject">' . $subject . '</td>';
    echo '<td class="average">' . number_format($rowAverageForMath['average_mark'], 2) . '</td>';

    // Display up to 5 marks for Chemistry (oldest first)
    for ($i = 1; $i <= 5; $i++) {
        $rowMark = $resultMarksForMath->fetch_assoc();
        echo '<td class="mark">' . ($rowMark ? $rowMark['mark'] : '') . '</td>';
    }

    echo '</tr>';
}

echo '</table>';
echo '</div>';

echo '</div>';

// Close connection
$conn->close();
?>


<?php
// Database connection parameters
$host = 'localhost'; // Change this if your database is hosted elsewhere
$dbname = 'supr';
$username = 'root';
$password = '';

// Create a database connection
try {
    $conn = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
    // Set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    // Query to fetch tests with the subject ID "Mathematics"
    $stmt = $conn->prepare("SELECT id, subject, content, date, time FROM tests WHERE subject = 'Chemistry' AND CONCAT(date, ' ', time) > :currentDateTime ORDER BY CONCAT(date, ' ', time) ASC");
    $currentDateTime = date("Y-m-d H:i:s");
    $stmt->bindParam(':currentDateTime', $currentDateTime);
    $stmt->execute();
    $tests = $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch(PDOException $e) {
    echo "Connection failed: " . $e->getMessage();
}
?>
<div class="container-fluid py-5">
    <div class="container py-5">
        <div class="text-center mb-5">
            <h5 class="text-primary text-uppercase mb-3" style="letter-spacing: 5px;">Tests</h5>
            <h1>Upcoming Chemistry tests</h1>
        </div>
        <?php if (empty($tests)): ?>
            <div class="text-center">
                <p>No upcoming tests for Chemistry.</p>
            </div>
        <?php else: ?>
            <div class="row">
                <?php foreach ($tests as $test): ?>
                    <div class="col-lg-4 col-md-6 mb-4">
                        <div class="rounded overflow-hidden mb-2">
                            <img class="img-fluid" src="img/subjects/<?php echo strtolower(str_replace(' ', '-', $test['subject'])); ?>.jpg" alt="<?php echo $test['subject']; ?>">
                            <div class="bg-secondary p-4">
                                <div class="d-flex justify-content-between mb-3">
                                    <small class="m-0"><i class="fa fa-calendar-alt text-primary mr-2"></i><?php echo date("F j, Y", strtotime($test['date'])); ?></small>
                                    <small class="m-0"><i class="far fa-clock text-primary mr-2"></i><?php echo date("h:i A", strtotime($test['time'])); ?></small>
                                </div>
                                <a class="h5" href="https://supr.melle-koot.com/test?id=<?php echo $test['id']; ?>"><?php echo $test['content']; ?></a>
                                <div class="border-top mt-4 pt-4">
                                    <div class="d-flex justify-content-between">
                                        <h6 class="m-0"><i class="fa fa-users text-primary mr-2"></i><a href="https://supr.melle-koot.com/<?php echo strtolower(str_replace(' ', '-', $test['subject'])); ?>"><?php echo $test['subject']; ?></a></h6>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                <?php endforeach; ?>
            </div>
        <?php endif; ?>
    </div>
</div>



    <!-- Footer Start -->
    <div class="container-fluid bg-dark text-white py-5 px-sm-3 px-lg-5" style="margin-top: 90px;">
        <div class="row pt-5">
            <div class="col-lg-7 col-md-12">
                <div class="row">
                    <div class="col-md-6 mb-5">
                        <a href="https://supr.melle-koot.com/contact">
                        <h5 class="text-primary text-uppercase mb-4" style="letter-spacing: 5px;">Get In Touch</h5>
                        </a>
                        <p><i class="fa fa-envelope mr-2"></i>[email protected]</p>
                        <div class="d-flex justify-content-start mt-4">
                            <a class="btn btn-outline-light btn-square mr-2" href="https://www.facebook.com/profile.php?id=61558039491926"><i class="fab fa-facebook-f"></i></a>
                            <a class="btn btn-outline-light btn-square mr-2" href="https://www.linkedin.com/in/mellekoot/"><i class="fab fa-linkedin-in"></i></a>
                            <a class="btn btn-outline-light btn-square" href="https://www.instagram.com/melle_k00t/"><i class="fab fa-instagram"></i></a>
                        </div>
                    </div>
                    <div class="col-md-6 mb-5">
                        <h5 class="text-primary text-uppercase mb-4" style="letter-spacing: 5px;">Sitemap</h5>
                        <div class="d-flex flex-column justify-content-start">
                            <a class="text-white mb-2" href="https://supr.melle-koot.com"><i class="fa fa-angle-right mr-2"></i>Homepage</a>
                            <a class="text-white mb-2" href="https://supr.melle-koot.com/grades"><i class="fa fa-angle-right mr-2"></i>Grades</a>
                            <a class="text-white mb-2" href="https://supr.melle-koot.com/calendar"><i class="fa fa-angle-right mr-2"></i>Calendar</a>
                            <a class="text-white mb-2" href="https://supr.melle-koot.com/blog"><i class="fa fa-angle-right mr-2"></i>Blog</a>
                            <a class="text-white" href="https://supr.melle-koot.com/about"><i class="fa fa-angle-right mr-2"></i>About</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-lg-5 col-md-12 mb-5">
           
            </div>
        </div>
    </div>
    <div class="container-fluid bg-dark text-white border-top py-4 px-sm-3 px-md-5" style="border-color: rgba(256, 256, 256, .1) !important;">
        <div class="row">
            <div class="col-lg-6 text-center text-md-left mb-3 mb-md-0">
                <p class="m-0 text-white">&copy; <a href="">Project Supr</a>. All Rights Reserved. Designed by <a href="https://melle-koot.com">Melle Koot</a>
                </p>
            </div>
            <div class="col-lg-6 text-center text-md-right">
                <ul class="nav d-inline-flex">
                   
                </ul>
            </div>
        </div>
    </div>
    <!-- Footer End -->


    <!-- Back to Top -->
    <a href="#" class="btn btn-lg btn-primary btn-lg-square back-to-top"><i class="fa fa-angle-double-up"></i></a>


    <!-- JavaScript Libraries -->
    <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
    <script src="lib/easing/easing.min.js"></script>
    <script src="lib/owlcarousel/owl.carousel.min.js"></script>

    <!-- Contact Javascript File -->
    <script src="mail/jqBootstrapValidation.min.js"></script>
    <script src="mail/contact.js"></script>

    <!-- Template Javascript -->
    <script src="js/main.js"></script>
    <script>
    // JavaScript for swipe functionality
    var startX;
    var startY;
    var isMoving = false;

    function handleTouchStart(event) {
        startX = event.touches[0].clientX;
        startY = event.touches[0].clientY;
        isMoving = true;
    }

    function handleTouchMove(event) {
        if (!isMoving) {
            return;
        }

        var currentX = event.touches[0].clientX;
        var currentY = event.touches[0].clientY;

        var diffX = startX - currentX;
        var diffY = startY - currentY;

        if (Math.abs(diffX) > Math.abs(diffY)) {
            event.preventDefault(); // Prevent vertical scrolling when swiping horizontally
        }
    }

    function handleTouchEnd(event) {
        var currentX = event.changedTouches[0].clientX;
        var diffX = startX - currentX;

        if (Math.abs(diffX) > 50) { // Minimum swipe distance threshold
            if (diffX > 0) {
                // Swipe right to left (scroll to next page)
                document.querySelector('.excel-table').scrollLeft += 300; // Adjust scroll distance as needed
            } else {
                // Swipe left to right (scroll to previous page)
                document.querySelector('.excel-table').scrollLeft -= 300; // Adjust scroll distance as needed
            }
        }

        isMoving = false;
    }

    // Attach touch event listeners
    var table = document.querySelector('.excel-table');
    table.addEventListener('touchstart', handleTouchStart, false);
    table.addEventListener('touchmove', handleTouchMove, false);
    table.addEventListener('touchend', handleTouchEnd, false);
</script>

</body>

</html>
1 Like

I hope you don’t use this on hosting

image

6 Likes

No ofcourse not I’m using this to show my entire code for the page on hosting it is changed to the correct hosting sql info.

Does it exist in DB everything necessary?

4 Likes

Yeah the sql databas on hosting is the Same as on local host

Online file (HTML section) is different from your source file

You have a carousel online, but in your source (here) it is not mentioned

as well as the part where the text is “getting into supreme college”, etc.

Have you uploaded the latest version for sure?

4 Likes

To start of the first 2 images are seperate pages the first one is the index.php and the other is the chemistry.php I provided.
Underneath is my localhost for the i

You still have localhost :joy:

Fatal error: Uncaught mysqli_sql_exception: No such file or directory in /home/vol17_1/infinityfree.com/if0_35718816/supr.melle-koot.com/htdocs/index.php:215 Stack trace: #0 /home/vol17_1/infinityfree.com/if0_35718816/supr.melle-koot.com/htdocs/index.php(215): mysqli->__construct(‘localhost’, ‘root’, Object(SensitiveParameterValue), ‘supr’) #1 {main} thrown in /home/vol17_1/infinityfree.com/if0_35718816/supr.melle-koot.com/htdocs/index.php on line 215

7 Likes

Yeah I just found out… must have forgot to change one back wow… Thanks for everyone’s help error has been fixed

for a better rating, it would be preferable to have DB conn in a separate file
and that you use .class

5 Likes

Thanks I will I kept on turning errors on for an entire different domain thats why it didn’t work must 've forgotton to change one localhost :sob: thanks for your help

1 Like

Error has been fixed

1 Like