<?php echo "<H2>Hello {$myUser->getEmail()}</H2>\n <h4> Have nice day !!!</h4>"; ?> <tr> <th>User Name</th> <th>Dweet</th> <th>Date</th> </tr> </thead> <tbody> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST)) { Tweet::createTweet($myUser->getId(), $_POST['tweet']); } $allTweets = Tweet::loadAllTweets(); foreach ($allTweets as $tweet) { echo "\n <tr>\n\n <td>"; $sql = "SELECT * FROM Users WHERE user_id = '{$tweet->getuserId()}';"; $result = $conn->query($sql); if ($result->num_rows == 1) { $row = $result->fetch_assoc(); echo $row['email']; } echo "\n <br> </td>\n <td>{$tweet->getText()}<br> </td>\n <td> {$tweet->getCreateDate()}<br></td>\n\n </tr>"; } ?> </tbody> </table>
<form action="edit.php"> <input type="submit" value="Edytuj swoj profil"> </form> <form action="messages.php"> <input type="submit" value="Sprawdź wiadomośći"> </form> <form action="logout.php"> <input type="submit" value="Wyloguj"> </form> <br> '; } foreach (Tweet::loadAllTweets($userToShow->getId()) as $tweet) { echo '<div class="date"> Czas tweeta: ' . $tweet['post_date'] . '</div>'; echo '<div class="tweet">' . $tweet['tweet'] . '</div>'; //formularz: dodanie komentarza do tweeta, każdy formularz pod tweetem zachowuje id danego tweeta dzięki inputowi hidden "tweet_id" echo ' <form method="POST" > <input type="hidden" name="forms" value="adding_comment"> <input type="text" name="comment"> <input type="hidden" name="tweet_id" value="' . $tweet['id'] . '"> <input type="submit" value="Dodaj komentarz"> </form> '; $comment_counter = 0; //licznik komentarzy zawsze zaczyna od zera foreach (Comment::loadAllComments($tweet['id']) as $comment) { $comment_counter++;