help me here to find what is wr The time , dosn't work , it show 0000. 00 . 00 As in picture I attached with the question.  Here the code for class and follow for the main.  db =  new mysqli(DBHOST, DBUSER, DBPASS, DBDATABASE);         if($this->db->connect_errno > 0) {         die("Connection error: " . $db->connect_error);         }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Can you help me here to find what is wr

The time , dosn't work , it show 0000. 00 . 00 As in picture I attached with the question. 

Here the code for class and follow for the main. 

<?php
//include("includes/config.php");

class Posts {
    private $db;

    // This __construct function I use to open up a connection to my database
    function __construct() {
        $this->db =  new mysqli(DBHOST, DBUSER, DBPASS, DBDATABASE);
        if($this->db->connect_errno > 0) {
        die("Connection error: " . $db->connect_error);
        }
    }
    // My method to read posts from my database
    public function getPosts() {
        // sql command to get data from my database table called 'guestbook'
        $sql = "SELECT * from guestbook /*ORDER BY created DESC*/";
        $result = $this->db->query($sql);

        return mysqli_fetch_all($result, MYSQLI_ASSOC);
    }

    public function addPost(string $user, string $content, $created ) {
        $created =date("M-d-Y h:i:s A");
        $sql = "INSERT INTO guestbook(user, content, created)VALUES('$user', '$content','$created')";

        return $this->db->query($sql);
    }

    public function deletePost(int $id) {
        $sql = "DELETE FROM guestbook WHERE id=$id";
        return $this->db->query($sql);
    }
}

The secound:

<?php $page_title = "Visitors's GuestBook"; ?>
    <?php include("includes/header.php"); ?>

    <?php include("includes/mainmenu.php"); ?>

    <article class="mainContent">

    <?php echo "<h1>$page_title</h1><br/>"; ?>

    <article class="guestbook-container">
    <div class="left-flexbox">

    <?php

        $post = new Posts();

        // add post to my guestbook
        if(isset($_POST['user'])) {
            $user = $_POST['user'];
            $content = $_POST['content'];
            $created = $_POST['created'];


            $post->addPost($user, $content, $created);
            header("Location: part2.php");
        }

    ?>

    <h3>Leave A Comment!</h3>
    <form action="part2.php" method="post">
    <label for="user">Your Name: </label>
    <input type="text" name="user" id="user">
    <br/>
    <br/>
    <label for="content"> Your Comment:</label>
    <textarea class="textrutan-message" name="content" id="content" rows="10" cols="30"></textarea>
    <br/><br/>
    <input type="submit" name="postMessage" value="Submit Your Post"><br/>
    </form>
    </div>

    <div class="right-flexbox">

    <?php
        $guestbookitems = $post->getPosts();

        foreach($guestbookitems as $item) {
            echo "<div class='div-containing-message'><h3>" . $item['user'] . "</h3>";
            echo "<p>" . $item['content'] . "</p>";
            echo "<h4>" . $item['created'] . "</h4></div>";
        }
    ?>
    </div>

    </article>  </article>
     <?php include("includes/footer.php"); ?>

Visitors's GuestBook
Leave A Comment!
Your Name:
Comment owner
My comment is here
0000-00-00
Your Comment:
Submit Your Post
Transcribed Image Text:Visitors's GuestBook Leave A Comment! Your Name: Comment owner My comment is here 0000-00-00 Your Comment: Submit Your Post
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY