Note that there are some explanatory texts on larger screens.

plurals
  1. POCant get time stamps for posts to stay posted correctly
    primarykey
    data
    text
    <p>I am trying to time stamp posts that people make on my simple blog website. I just want the timestamp to be at the bottom of their posts. I have it working now, however once I make a new posts, all the time stamps for recent posts update to the new posts timestamp. Not sure how to go about fixing this tho, I tried different php time stamps, etc but still no go. Thanks in advance for helping me!</p> <p>Here is my PHP</p> <pre><code> &lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;link type="text/css" rel="stylesheet" href="post.css" /&gt; &lt;meta name="viewport" content="width=device-width" /&gt; &lt;title&gt;Daily Dorm News&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Your Daily Dorm News Post! &lt;/h1&gt; &lt;div id="container"&gt; &lt;?php if ( isset($_GET['name']) and preg_match("/^[A-Za-z0-9]+$/", $_GET['name']) ) { echo $_GET['name']; } else { echo "You entered an invalid name!\n"; } ?&gt;&lt;br&gt; Your email address is: &lt;?php if ( isset($_GET['email']) and preg_match("/.+@.+\..+/i", $_GET['email']) ) { echo $_GET['email']; } else { echo "You didn't enter a proper email address!\n"; } ?&gt;&lt;br&gt; You Posted : &lt;?php if ( isset($_GET['message']) and preg_match("/^[A-Za-z0-9]+$/", $_GET['message']) ) { echo $_GET['message']; } else { echo "The message is not valid! The message box was blank or you entered invalid symbols!\n"; } ?&gt; This event happened :&lt;?php echo $_GET["date"]; ?&gt;&lt;br&gt; &lt;/div&gt; &lt;?php /* [INFO/CS 1300 Project 3] index.php * Main page for our app. * Shows all previous posts and highlights the current user's post, if any. * Includes a link to form.php if user wishes to create and submit a post. */ require('wall_database.php'); // Fetching data from the request sent by form.php $name = strip_tags($_REQUEST['name']); $email = strip_tags($_REQUEST['email']); $message = strip_tags($_REQUEST['message']); $date = strip_tags($_REQUEST['date']); $is_valid_post = true; // Checking if a form was submitted if (isset($_REQUEST['name'])){ // Fetching data from the request sent by form.php $name = strip_tags($_REQUEST['name']); $email = strip_tags($_REQUEST['email']); $message = strip_tags($_REQUEST['message']); $date = strip_tags($_REQUEST['date']); // Saving the current post, if a form was submitted $post_fields = array(); $post_fields['name'] = $name; $post_fields['email'] = $email; $post_fields['message'] = $message; $post_fields['date'] = $date; $success_flag = saveCurrentPost($post_fields); } //Fetching all posts from the database $posts_array = getAllPosts(); require('header.php'); ?&gt; &lt;?php date_default_timezone_set('America/New York'); $date_posted = date('h:i:s Y-m-d'); ?&gt; &lt;p&gt;&lt;a href="form.php"&gt;Submit a Post&lt;/a&gt;&lt;/p&gt; &lt;?php if(isset($name)) { echo "&lt;h3&gt;Thanks ".$name." for submitting your post.&lt;/h3&gt;"; } ?&gt; &lt;p&gt;Here are all the posts we have received.&lt;/p&gt; &lt;ul id="posts_list"&gt; &lt;div id="posts"&gt; &lt;?php // Looping through all the posts in posts_array $counter = 1; foreach(array_reverse($posts_array) as $post){ $name = $post['name']; $email = $post['email']; $message = $post['message']; $date = $post['date']; if ($counter % 2==1) $li_class = "float-left"; else $li_class = "float-right"; echo '&lt;div class=post&gt;'; echo '&lt;li class="'.$li_class.'"&gt;&lt;h3&gt;&lt;span&gt;'.$name.'&lt;/span&gt; wrote a post.&lt;/h3&gt;&lt;/li&gt;'; echo '&lt;li class="'.$li_class.'"&gt;&lt;h3&gt;&lt;span&gt;'.$name.' email is: '.$email.'&lt;/span&gt;&lt;/h3&gt;&lt;/li&gt;'; echo '&lt;li class="'.$li_class.'"&gt;&lt;h3&gt;&lt;span&gt;'.$name.' wrote '.$message.'&lt;/span&gt; wrote a post.&lt;/h3&gt;&lt;/li&gt;'; echo '&lt;li class="'.$li_class.'"&gt;&lt;h3&gt;&lt;span&gt;This evemt occured on '.$date.'&lt;/span&gt;&lt;/h3&gt;&lt;/li&gt;'; echo $date_posted; echo date('l jS \of F Y h:i:s A'); echo '&lt;/div&gt;'; } ?&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload