0

Hello for an easy data handling I though of creating a class but I think I must have missed something as it stops the page from loading when I include it.

I think that the error must be something very simple but I don't have much experience in coding in php so if someone could point me in the direction of the mistake and give me an idea of what to implement to resolve this issue.

Like said above in this scenario it will ouput the page until test and then it wont put the rest.

index.php:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>test</p>
<?php include("class_lib.php"); ?>
<p>test2</p>
</body>
</html>

class_lib.php:

<?php
class MyAbility{
    var $Name;
    var $URL;
    var $Level1;
    var $Level2;
    var $Level2;
    var $Level4;
    var $Level5;
    function set_Name($new_name) { 
        $this->Name = $new_name;  
    }
    function get_Name() {
        return $this->Name;
    }
    function set_URL($new_URL) { 
        $this->URL = $new_URL;  
    }
    function get_URL() {
        return $this->URL;
    }
    function set_Level1($new_Level1) { 
        $this->Level1 = $new_Level1;  
    }
    function get_Level1() {
        return $this->Level1;
    }
    function set_Level2($new_Level2) { 
        $this->Level2 = $new_Level2;  
    }
    function get_Level2() {
        return $this->Level2;
    }
    function set_Level3($new_Level3) { 
        $this->Level3 = $new_Level3;  
    }
    function get_Level3() {
        return $this->Level3;
    }
    function set_Level4($new_Level4) { 
        $this->Level4 = $new_Level4;  
    }
    function get_Level4() {
        return $this->Level4;
    }
    function set_Level5($new_Level5) { 
        $this->Level5 = $new_Level5;  
    }
    function get_Level5() {
        return $this->Level5;
    }
}
?>
Mederic
  • 1,949
  • 4
  • 19
  • 36
  • What is the error? – meun5 May 10 '17 at 15:59
  • 1
    See [this canonical answer for how to get the error message](http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php/12772851#12772851), at which point the solution should be obvious. – IMSoP May 10 '17 at 16:04
  • On a side note, `var` is an outdated way of declaring properties. It resolves to `public`, but considering you have accessor methods, you might as well set them to protected or private. – Don't Panic May 10 '17 at 16:04
  • @IMSoP Sorry I didn't know could get the error code in php quite new to the language i will follow the logging example provided Ron to easily not make duplicate in future use. – Mederic May 10 '17 at 16:05
  • @Don'tPanic thanks for the tip will do! – Mederic May 10 '17 at 16:05

1 Answers1

2

Declared twice my friend :-) var $Level2;

https://phpcodechecker.com/

More about forcing to print out the error. http://www.ronaldpringadi.com/archives/introduction-to-logging-and-tracing-in-php/

RonPringadi
  • 1,294
  • 1
  • 19
  • 44
  • 1
    I knew it was something stupid thanks for the help i'll keep the tool and the loggin in mind for the rest of the project! – Mederic May 10 '17 at 16:03