Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7890461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:21:37+00:00 2026-06-03T06:21:37+00:00

First off whenever this page loads I see commented on December 31, 1969 at

  • 0

First off whenever this page loads I see “commented on December 31, 1969 at 5:00 PM” when there is no comment and when a comment is submitted I see “Column count doesn’t match value count at row 1”
My table for comments look like this

id int(11)
comment_date datetime
first_name varchar(50)
last_name varchar(50)
content varchar(500)
post_id int(11)

  <?php require_once('Connections/Main.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form")) {
  $insertSQL = sprintf("INSERT INTO blog_comments (first_name, last_name, content, post_id) VALUES (%s, now(), %s, %s, %s)",
                       GetSQLValueString($_POST['first_name'], "text"),
                       GetSQLValueString($_POST['last_name'], "text"),
                       GetSQLValueString($_POST['content'], "text"),
                       GetSQLValueString($_POST['post_id'], "int"));

  mysql_select_db($database_Main, $Main);
  $Result1 = mysql_query($insertSQL, $Main) or die(mysql_error());
}

$colname_getSinglePost = "-1";
if (isset($_GET['post_id'])) {
  $colname_getSinglePost = $_GET['post_id'];
}
mysql_select_db($database_Main, $Main);
$query_getSinglePost = sprintf("SELECT post_id, post_date, post_img, content, tags, post_title FROM blog_posts WHERE post_id = %s LIMIT 1", GetSQLValueString($colname_getSinglePost, "int"));
$getSinglePost = mysql_query($query_getSinglePost, $Main) or die(mysql_error());
$row_getSinglePost = mysql_fetch_assoc($getSinglePost);
$totalRows_getSinglePost = mysql_num_rows($getSinglePost);

$maxRows_getSingleComments = 20;
$pageNum_getSingleComments = 0;
if (isset($_GET['pageNum_getSingleComments'])) {
  $pageNum_getSingleComments = $_GET['pageNum_getSingleComments'];
}
$startRow_getSingleComments = $pageNum_getSingleComments * $maxRows_getSingleComments;

$colname_getSingleComments = "-1";
if (isset($_GET['post_id'])) {
  $colname_getSingleComments = $_GET['post_id'];
}
mysql_select_db($database_Main, $Main);
$query_getSingleComments = sprintf("SELECT id, first_name, comment_date, last_name, content, post_id FROM blog_comments WHERE post_id = %s", GetSQLValueString($colname_getSingleComments, "int"));
$query_limit_getSingleComments = sprintf("%s LIMIT %d, %d", $query_getSingleComments, $startRow_getSingleComments, $maxRows_getSingleComments);
$getSingleComments = mysql_query($query_limit_getSingleComments, $Main) or die(mysql_error());
$row_getSingleComments = mysql_fetch_assoc($getSingleComments);

if (isset($_GET['totalRows_getSingleComments'])) {
  $totalRows_getSingleComments = $_GET['totalRows_getSingleComments'];
} else {
  $all_getSingleComments = mysql_query($query_getSingleComments);
  $totalRows_getSingleComments = mysql_num_rows($all_getSingleComments);
}
$totalPages_getSingleComments = ceil($totalRows_getSingleComments/$maxRows_getSingleComments)-1;
?>

//Post Code…

//Comment Code=

<?php do { ?>
            <div id="comments" style="border-bottom:1px solid #000; margin-bottom:3px;">
            <?php $row_getSingleComments = mysql_fetch_assoc($getSingleComments); ?>
            <div class="single"> 
<span class="author"><?php echo $row_getSingleComments['first_name']; ?> <?php echo $row_getSingleComments['last_name'];?> commented on <?php $phpdate = strtotime($row_getSingleComments['comment_date']);
$mysqldate = date('F j, Y',$phpdate); echo $mysqldate; ?> at <?php $mysqltime = date('g:i A',$phpdate);  echo $mysqltime; ?></span><br />
<?php echo $row_getSingleComments['content']; ?>
</div>
            <?php } while ($row_getSingleComments = mysql_fetch_assoc($getSingleComments)); ?>
          <p>Add a Comment</p>
          <form method="POST" action="<?php echo $editFormAction; ?>" name="form">
            <p> First Name
              <input type="text" name="first_name" />
              <br/>
              Last Name
              <input type="text" name="last_name" />
              <textarea name="content" cols="60" rows="15"></textarea>
            </p>
            <input type="hidden" value="<?php echo $colname_getSinglePost ?>" name="post_id" />
            <input type="submit" name="submit" id="submit" value="Submit" style="float:right;" />
            <input type="hidden" name="MM_insert" value="form" />
          </form>
        </div>
        </div>
        </div>
    </div><!-- end #content -->
<?php mysql_free_result($getSinglePost);

mysql_free_result($getSingleComments);?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:21:39+00:00Added an answer on June 3, 2026 at 6:21 am

    Your SQL fields do not match their inputs. You’re not entering the date in the proper field, change it to this:

    INSERT INTO blog_comments (first_name, comment_date, last_name, content, post_id) VALUES (%s, now(), %s, %s, %s)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off, there's a bit of background to this issue available on my blog:
EDIT : see bottom First off I searched for an answer before asking this
First off, this example will only work in a browser that supports :nth-child ,
First off, thank you to everyone on this site...it's been INCREDIBLY helpful in getting
First off - apologies if this or a similar question has been asked before.
First off, if this is a duplicate, I apologize. I did quite a bit
First off, I apologize for my inaccurate vocabulary. I am an absolute ground-zero beginner.
First off: Why is dependency management for obj-c projects such a pain?! I am
First off, I am using Windows XP. I have multiple hard drives and it
First off, I understand the reasons why an interface or abstract class (in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.