Jump to content

php code won't print


Go to solution Solved by kicken,

Recommended Posts

Hi! 

 

php code copied form the book Begining php and MySQL (Apress) will not print:

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <?php
       
        class Book
            {
                // definicija polja
                private $title;
                private $isbn;
                private $copies;
                
               // konstruktor
                public function _construct($isbn)
                    {
                    $this->setIsbn($isbn);
                    $this->getTitle();
                    $this->getNumberCopies();
                     }
            
                public function setIsbn($isbn)
                    {
                        $this->isbn = $isbn;
                    }
                    
               public function getTitle() {
                    $this->title = "Beginning Python";
                    print "Title: ".$this->title."<br />";
                    }
                    
                public function getNumberCopies() {
                    $this->copies = "5";
                    print "Number copies available: ".$this->copies."<br />";
                    }
            }
            
       $book = new book("159059519X");
    
        ?>
        
    </body>
</html>

Tried it on Turnkey LAMP and 000webhost, on several major browsers.

 

Is something wrong?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/282912-php-code-wont-print/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.