Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6915425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:28:24+00:00 2026-05-27T09:28:24+00:00

I am running into a blank page, and although I have told PHP to

  • 0

I am running into a blank page, and although I have told PHP to report all errors I still get nothing which leads me to believe it must be a syntax error. I can’t find what it is though.

Here is the script I am working on:

test.php

<?php
ini_set('display_errors', '1');
require('database.php');

print("hello");

$config = new Config("lessons.db","data/");
$db = new Database($config, array('first', 'second', 'third', 'fourth'), true);

print_r($db->dumpToArray());
?>

database.php

<?php
    class Config {
        private
            $_db
            $_file,
            $_directory,
            $_delimiter,
            $_columns;

        public function __construct(string $file, string $directory = null, string $delimiter = "|")  {
            $_db = $directory.$file;
            $_directory = $directory;
            $_delimiter = $delimiter;
        } 
        public function db() {
            return $_db;
        }
        public function delimiter() {
            return $_delimiter;
        }

    }       
    class Database {
        private
            $_config,
            $_columns,
            $_rows,
            $_pointer;

        public function __construct(Config $config, array $constants = null, boolean $caseInsensitive = false)  {
            $_config = $config;
            is_readable ($_config->db())
                or exit ("The database cannot be read");
            if(!is_null($constants))
                $this->defineColumns($constants, $caseInsensitive);
            return;
        } 

        private function connect(string $method) {
            if (!($_pointer = @fopen($_config->db(), $method)) or printf("Unable to connect to database");
        }

        private function disconnect() {
            fclose($_pointer);
        }

        private function defineColumns($constants, $caseInsensitive) {
            for (var $i=0;$i<count($constants);$i++)
                define($constants[i], $i, $caseInsensitive);                
        }

        public function dumpToArray() {
            $arrayDump = explode($_config->delimiter(), file($_config->db(), FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES));
            return $arrayDump;
        }

        public function getRowByValue($column, $value) {
            $this->connect('r');
            $rowNumber = 0;
            while (!feof($_Pointer)) {
                $row = explode($_config->delimiter(), fgets($dbPointer, 1024));
                if ($row[$column] == $value) {
                    $this->disconnect();
                    return $row;
                }
                $rowNumber++;
            }
            $this->disconnect();
            return false;
        }       
    }
?>

Anyone can see what could be causing it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:28:25+00:00Added an answer on May 27, 2026 at 9:28 am

    I think require(database.php); should be require('database.php');.

    Try changing that and see if it helps

    Also, you’re missing a semicolon on

    return $arrayDump
    

    EDIT

    Okay, I’m not too sure, but try to remove the casting from the parameters of the functions.

    So…

    public function __construct(Config $config, array $constants = null, boolean $caseInsensitive = false) 
    

    Would be

    public function __construct($config, $constants = null, $caseInsensitive = false)  {
    

    I don’t do much OOC in PHP, but just taking another shot.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Running into a problem where on certain servers we get an error that the
Running into a problem. I have a table defined to hold the values of
I'm running into an issue where I have a FileUpload control in an UpdatePanel.
All, I am running into an issue using JTextArea and JScrollPane. For some reason
I get the following error when running an sqr report on DB2: SQL0100W -
I have a quick question with some jQuery where I'm running into a problem.
I'm running into an issue with a web application that is exhausting all available
I have a dashboard which starts in a blank/default state. I am giving the
Been running into this problem lately... When debugging an app in VS.Net 2005, breakpoints
I am currently running into a problem where an element is coming back from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.