My DIV section is not displaying when I test in browser.
When I test view_thread.php, I get this echo response from line 13 ERROR: That thread does not exist. DIV is at line 167-191 (marked). FYI - The two database Tables for this Forum that I'm "trying" to build are up and running.
<?php
session_start();
include_once "../scripts/connect_to_mysql.php"; // Connect to the database
// Connect to the class file for converting date_time to "Ago" format
include_once ("../wi_class_files/agoTimeFormat.php");
$myAgoObject = new convertToAgo; // Establish the object
// Get the "id" URL variable and query the database for the original post of this thread
$thread_id = preg_replace('#[^0-9]#i', '', $_GET['id']);
$sql = mysql_query("SELECT * FROM forum_posts WHERE id='$thread_id' AND type='a' LIMIT 1");
$numRows = mysql_num_rows($sql);
if ($numRows < 1) {
echo "ERROR: That thread does not exist.";
exit();
}
while($row = mysql_fetch_array($sql)){
$post_author = $row["post_author"];
$post_author_id = $row["post_author_id"];
$date_time = $row["date_time"];
$date_time = strftime("%b %d, %Y", strtotime($date_time));
$section_title = $row["section_title"];
$section_id = $row["section_id"];
$thread_title = $row["thread_title"];
$post_body = $row["post_body"];
}
?>
<?php
// Now query any responses out of the database and place in a dynamic list
$all_responses = "";
$sql = mysql_query("SELECT * FROM forum_posts WHERE otid='$thread_id' AND type='b'");
$numRows = mysql_num_rows($sql);
if ($numRows < 1) {
$all_responses = '<div id="none_yet_div">Nobody has responded to this yet, you can be the first.</div>';
} else {
while($row = mysql_fetch_array($sql)){
$reply_author = $row["post_author"];
$reply_author_id = $row["post_author_id"];
$date_n_time = $row["date_time"];
$convertedTime = ($myAgoObject -> convert_datetime($date_n_time));
$whenReply = ($myAgoObject -> makeAgo($convertedTime));
$reply_body = $row["post_body"];
$all_responses .= '<div class="response_top_div">Re: ' . $thread_title . ' • ' . $whenReply . '
<a href="../res.php?id=' . $reply_author_id . '">' . $reply_author . '</a> Said/div>
<div class="response_div">' . $reply_body . '</div>';
}
}
?>
<?php
// Be sure the user session vars are all set in order to show them the "replyButton"
$replyButton = 'You must <a href="http://www.***********.com/ckin.php">CHECK IN</a> to respond';
if (isset($_SESSION['id']) && isset($_SESSION['username']) && isset($_SESSION['useremail']) && isset($_SESSION['userloca'])) {
$replyButton = '<input name="myBtn1" type="submit" value="Post a Response" style="font-size:16px; padding:12px;" onmousedown="javascript:toggleForm(\'reponse_form\');" />';
}
// Check the database to be sure that their ID, locator, and email session variables all match in the database
$u_id = mysql_real_escape_string($_SESSION['id']);
$u_name = mysql_real_escape_string($_SESSION['username']);
$u_email = mysql_real_escape_string($_SESSION['useremail']);
$u_loca = mysql_real_escape_string($_SESSION['userloca']);
$sql = mysql_query("SELECT * FROM myMembers WHERE id='$u_id' AND username='$u_name' AND email='$u_email' AND locator='$u_loca'");
$numRows = mysql_num_rows($sql);
if ($numRows < 1) {
$replyButton = 'You Must <a href="../ckin.php">CHECK IN</a> to Respond';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style/style.css" rel="stylesheet" type="text/css" />
<script src="../js/jquery-1.7.1.js" type="text/javascript"></script>
<title><?php echo $thread_title; ?></title>
<script language="javascript" type="text/javascript">
function toggleForm(x) {
if ($('#'+x).is(":hidden")) {
$('#'+x).slideDown(200);
} else {
$('#'+x).slideUp(200);
}
}
$('#responseForm').submit(function(){$('input[type=submit]', this).attr('disabled', 'disabled');});
function parseResponse ( ) {
var thread_id = $("#thread_id");
var post_body = $("#post_body");
var fs_id = $("#forum_section_id");
var fs_title = $("#forum_section_title");
var u_id = $("#tktedmembers_id");
var u_loca = $("#tktedmembers_locator");
Bookmarks